Monday, April 16, 2012

JSF 2 on JBoss AS 5.1.0

I was confronted with a requirement to run JSF 2 on JBoss Application Server 5.1.0 on Friday. As you may know, JSF 2.0 will run on Java EE 5 application servers, but not with all the bells and whistles that we have come to expect with Java EE 6.

Requirements

Instructions

  1. Install JBoss Application Server.
  2. Make sure that the server is not running.
  3. Go to the <jboss_home>/server/default/deploy/jbossweb.sar/jsf-libsdirectory.
  4. move the jsf-api.jar and jsf-impl.jar to a safe location. We will be replacing it with the javax.faces.jar from the JSF 2.0.9.zip distribution.
    Note: the javax.faces and com.sun.faces files are combined in one jar now. The Mojarra Reference Implementation is in a single jar now.
  5. Go to the <jboss_home>/server/default/deployers/jbossweb.deployer directory.
  6. Open the web.xml in a text editor and comment out the following lines:
  7. Start the application server and check the logs. You should see something like the following:
    14:23:30,058 INFO [TomcatDeployment] deploy, ctxPath=/admin-console
    14:23:30,257 INFO [config] Initializing Mojarra 2.0.9 (SNAPSHOT 20120202) for context '/admin-console'
    14:23:45,013 INFO [application] JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans
    methods marked with these annotations will have said annotations processed.

Summary

You should be able to install and use JSF 2 with Java EE 5 Application servers like JBoss AS 5.1.0 without issues by simply updating the required JSF libraries.

0 comments :

Popular Posts