Archetype: RichFaces 4.1.0.Final + Spring 3.1.0.RELEASE + Hibernate 3.3.0

This maven2 archetype contains a little sample web application with this Frameworks:

  • Spring 3.1.0.RELEASE Framework
  • Servlet-API 2.5
  • JSF 2.0 (mojarra 2.1.2)
  • RichFaces 4.1.0.Final
  • ploinFaces 1.6
  • ploinMailFactory 1.3.1
  • Hibernate 3.3.0
  • TestNG 5.8
  • Log4J 1.2.15
  • HSQLDB 1.8.0.7

The configuration is annotation-driven. It is deployed on the PLOIN Repository-Server

http://www.ploin-m2.de/nexus/content/groups/public/

you can create a project from the archetype with the following command:

mvn archetype:generate -DarchetypeGroupId=org.ploin.archetype -DarchetypeArtifactId=demoSpringRichHibernate-archetype -DarchetypeVersion=1.2 -DarchetypeRepository=http://www.ploin-m2.de/nexus/content/groups/public/ -DgroupId=com.versioneye -DartifactId=myNewWebApp

The created project is a very simple web-application with a login mask and 2 xhtml-sites. I have tested the app on a tomcat 6.0.35 and Java 1.6 on Mac OS X Lion.

On the second page there is a small demonstration of the JSF 2.0 AJAX feature. Every time you type something in into the first input field, there is a whole server roundtrip. The ManagedBean gets updated immediately.

On the same page there is a small demo for the RichFaces calendar.

After the creation the app is running with the HypersoniceSQL DBMS. But it is very easy to switch to MySQL or Oracle. I put the drivers for MySQL and Oracle as a comment in the pom.xml. So you just need to comment in the right lines in the pom.xml.

59 thoughts on “Archetype: RichFaces 4.1.0.Final + Spring 3.1.0.RELEASE + Hibernate 3.3.0

  1. Hi Robert,
    Thanks for the updated code. I tried to change the skin, but it did not work. I tried to set param in web.xml. No luck. 😦

    org.richfaces.CONTROL_SKINNING_CLASSES
    enable

    Any valuable inputs ?

    Thanks,
    Baskar

  2. Hey Guys,

    I am sorry for my late response. I was busy with some other projects. I just fixed the bug with the skinning. Just use version 1.2 of the archetype. The archetype is now using the “ruby” skin. That is something with red colors. 🙂
    Enjoy! And let me know, when you have other issues.

  3. Buenas,
    ¿sabéis si hay algún problema con el servidor para descargar el artifact? Es que llevo desde el jueves intentandolo descargar y no hay manera, el servidor rechaza la conexión o dice que no puede atender mas peticiones. ¿Se podría colgar en otro lado para añadirlo manualmente al repositorio local de maven?
    Gracias.

  4. I am sorry for that. I am not anymore working for PLOIN. but I have send a email to the PLOIN folks. If the server is not up in the next 24 hours, I will host the artifacts somewhere else.

  5. Hey guys.

    I am sorry for the server issues. I now that the PLOIN admins are working on a new PLOIN Maven2 Repository Server.

    And I am pretty busy right now with the http://VersionEye.com project.
    As soon I have time I will host my archetypes on the central maven2 repository server.
    I hope I will be able to do that this week.

    Thank you guys for your passion.

  6. Hi Robert,

    can you also please send me the artifact via email? I’ve checked the repo site for several times in the past couple of weeks and it was down all the time.

    Or maybe the folks that have the artifact already, can you please guys share it with me? alexandru dot ionita at gmail dot com

    Kind regards
    Alexandru

  7. Hi Robert,
    I created the project using maven 2.2.1, then created an eclipse project with mvn eclipse:eclipse.
    When I import the project as maven project (Eclipse Indigo) I get an error in UserDaoTest.java:
    Multiple markers at this line
    – The hierarchy of the type UserDaoTest is inconsistent
    – The type org.testng.IHookable cannot be resolved. It is indirectly referenced from required .class files
    – The type org.springframework.context.ApplicationContextAware cannot be resolved. It is indirectly referenced from required .class files

    Any ideas?

  8. Hi Robert,
    I managed to figure out the above errors. Seems that three of the dependencies (spring 3.1.0, testng-5.9 and hsqldb) were corrupted, I could not even open the class files in the jars with eclipse. I don’t know why, I just deleted them from .m2 and started again. Now all is okeydokey. Next step, implement the mysql instead of hsqldb…

    Thanks a million for this amazing solution, first one I’ve come across which actually works

  9. Hi again Robert,
    I changed the applicationContext.xml as follows:

    <!– classpath:hibernate_hsqldb.properties –>
    classpath:hibernate_mysql.properties
    classpath:settings.properties

    Now when I try to run it on tomcat6, I am getting an referring to:
    Caused by: org.hibernate.HibernateException: Dialect class not found: com.versioneye.utils.db.PloinMySqlDialect
    Where is this in the project?

  10. Me again Robert,
    Don’t worry, I found the class in the http://ploin-m2.de/nexus/
    repositoritories under ploinUtils-1.6.8-sources.jar and just created a new package com.versioneye.utils.db and copied it to there. Everthing back OkeyDokey for the mo…

  11. I using SpringSource tool Suit IDE, and I have anther problem ,,many component of richface doesn’t work like

    thanks.

    1. Well. That look like it is a problem of the SpringSource IDE. The archetype itself is working fine. By the way, I am using IntelliJ IDEA. I am not used to SpringSource IDE. Maybe you are googling for SpringSource IDE & RichFaces.

      1. After you created the archetype, you can compile it with maven. That should work without problems. If that is working you can start it on a Tomcat from Eclipse or IDEA. That works out of the box.

  12. exactly, there are component richface working well and there’s no other. it’s like demoSpringrichface example

    thank you

  13. HI Robert,
    I was trying to implement a Controller in this sample application. Below is my code.

    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.servlet.ModelAndView;
    import com.versioneye.gui.model.Personal_Info;

    @Controller
    public class HelloController {
    @RequestMapping(value = “/page/hello”,method = RequestMethod.GET)
    public ModelAndView printWelcome() {
    Personal_Info personal_Info = new Personal_Info();
    personal_Info.setNumber(“121212”);
    personal_Info.setName(“Smith”);
    ModelAndView modelAndView = new ModelAndView(“/page/memyself/personalInfo”); //I have personalInfo.xhtml in this location
    modelAndView.addObject(“info”, personal_Info);
    return modelAndView;
    }
    }
    Then, I typed in browser:
    http://localhost:8080/myNewWebApp-1.0-SNAPSHOT/page/hello.jsf

    But I get “ERROR 404 – Resource not found “. I am wondering if I need to implement any request mapping. Could you please point what I miss here ?

    Thanks in advance.

    1. You are trying to implement a SpringMVC Controller in JSF Application !?
      Are you sure? I mean you can do that, but usually it is not a good idea to mix 2 different Web Frameworks.

      If you anyway want to use a Spring Action Controller in a JSF App, then you have to customize your web.xml. You have to ensure that specific requests go the the JSF request handler and other specific requests go to the SpringMVC request handler. I did that 1 times, and it worked out. But usually you should go with 1 single Web Framework.

      1. Well, Forgive my ignorance. 🙂 This is my idea. I want Spring MVC framework to handle my requests and to use Richfaces as just view layer. So, what am I supposed to do ?

      2. Well. That will not work out. RichFaces is a full stack WebFramework. If you are using RichFaces UI Components you need JSF Managed Beans to handle the request. And it is not just the Managed Beans it is all about the JSF Lifecycle.
        There is now way to use JSF Components without JSF Managed Beans and the JSF Lifecycle.

        If you want to use SpringMVC, you should use JSPs for your view layer. You can use this Archetype for that:
        https://robert-reiz.com/2011/02/21/archetype-springmvc-spring-3-0-5-release-jpa-1-0/

        SpringMVC is much more lightweight than JSF. You have nice bookable URLs and full control about the HTML. But you can still use JavaScript UI Components, for example jQuery UI.

  14. Thank you very much for you reply. In that case, I need to think about Javascript frameworks in place of Richface components. Anyway, do you think we miss many features of Spring modules(like webflow, orm, security, etc) , If we use Richfaces framework ?

    1. So, if I understand correctly we cannot use JSF along with Spring MVC. Is that correct ? And, is there any alternative for template mechanism when we dont use JSF ?

      1. You can not use SpringMVC and JSF on the same page. You can have an Application there some pages are completely handled by JSF and some other pages are completely handled by SpringMVC. But that is a little bit complicated. I wouldn’t recommend that.

        If you go with SpringMVC you have different options for the view layer. Of course you can use pure JSP. But you can also use templating engines like sitemash, tiles or Thymeleaf. Here are some links for you:

        http://www.thymeleaf.org/thvsjsp.html

        http://stackoverflow.com/questions/11923575/jinja2-like-view-templating-approach-for-spring-mvc

        And you can mix that with jQuery UI and other JavaScript UI Components.

  15. Hi Guys. The ploin-m2.de server is still down. I am sorry for that. Unfortunately I am not anymore the owner of the PLOIN company and the ploin-m2.de server. I don’t have root access server to reboot it. I am looking for a place to host my archetypes.

    But you can find the source code to this archetype also on GitHub:
    https://github.com/reiz/demoSpringRichHibernate-archetype

    just check it out with:

    “git clone https://github.com/reiz/demoSpringRichHibernate-archetype

    and install it with “mvn install”.
    Hope that will you guys.

  16. Hi Robert, i just downloaded the archetype to play for, and i ask myself why do you need two pom.xml files, one on top folder, as usual, and one more on MYPROJECT//demoSpringRichHibernate-archetype/src/main/resources/archetype-resources/pom.xml

    That question came to me because i would like to use jetty as embeded app server and i need to include on pom.xml file.

    Thank you

    1. The archetype project itself needs 2 pom.xml files. 1 pom.xml describes the archetype project itself and the 2nd pom.xml describes the project you will create out of the archetype.

  17. Hi Robert…thanks for the maven archetype
    How can I configure annotated entity classes in configuration? Could you please me on this?

      1. Robert Reiz,

        Hi ..In great need of ploinUtils-1.6.8 jar and would be awesome if you could send me.. aviinash.13@gmail. Com.. Thanks.

      2. I don’t work for PLOIN anymore and I don’t have the jar file anymore. Contact the guys at PLOIN (info@ploin.de) and ask them to send you the jar file. Or ask them to make make their M2 Repository public. That is would fix all your issues with the jar.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s