JSF 2.0 and JBoss 4.2.0 Configuration Common Problems and Solutions for Begginers


I almost spent 3 days in creating a new project in Java Server Faces (JFS 2.0 ) in the  JBoss AS 4.2.0 .I made some very small mistakes but atlast after 3 days of hard work i understood the problems and now able to succesfully run a JSF 2.0 project in JBoss AS 4.2 .

Problem 1

ERROR [[/MyFirstJSF]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
java.lang.ClassCastException: com.sun.faces.config.WebConfiguration cannot be cast to com.sun.faces.config.WebConfiguration
at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:170)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:161)

………………………………………………………………………………………………..

ERROR [StandardContext] Error listenerStart
ERROR [StandardContext] Context [/MyFirstJSF] startup failed due to previous errors ….

……………………..

This might give you 404 error in the browser .

Solution :

If are having this trouble you might have jsf-impl.jar library in your projects war file . You do not need to externally add jsf libraries in your project as jboss already has them included . Remove all the jsf libraries jsf-impl.jar  , jsf-api.jar , jboss-jsf.jar from your project’s war file .

Problem 2 :

I tried to include a Facelet in my project . But from the client page using ui:define no css or image was displayed . It seems like Facelet is not working .

Solution :

I was using JBoss 4.2.0 AS , I have to replace all the jsf libraries with some new ones . The new jsf-libs carries some extra features for JSF 2.0 version .


Leave a Reply