Error starting JSF application on Jboss 5.0

I am new to JSF, I recently started working with a tutorial. I created the application in the same way as the information presented in the tutorial. However, when I start the server, I get the following error:

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:154) at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:145) 

web.xml

 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Hello, World</display-name> <description>Welcome to JavaServerFaces</description> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> </web-app> 

As stated in the tutorial, I added jsf-api and jsf-impl to Web-Inf / lib, but for Google, he found that jboss has its own version of jsf, which can pollute my application with several versions of jsf. If so, how can I solve the problem or if I am wrong, then what is the cause of the error?

Just add, since I think its jar conflit files I tried to add jar files imported from jboss from jboss-5.1.0.GA\server\default\deploy\jbossweb.sar\jsf-libs , all the same in vain.

Please, help.

+4
source share
3 answers

The best way to deal with the conflict is to add the context parameter to web.xml, as I mentioned below:

 <context-param> <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name> <param-value>true</param-value> </context-param> 

Check out: JSF binding inside your WAR

+5
source

I do not know how your Eclipse is configured (Java EE / JBoss tools, etc.). But you have to add the server working environment to your web project:

  • Add Server Runtime

1.1 open server view in Eclipse

1.2 Context menu, and then β†’ new server-> select the type of server JBoss 5.0

1.3 Runtime Environment β†’ Add

1.4 Home directory-> your home / default, e.g.

  • Now change the build path of your web project.

2.1. Add library-> server runtime-> select a new runtime

2.3 No JSF or other libraries in your ear or in your web projects Web-Inf / lib

Now you have all the Jboss-libs, including jsf-libs in your path to the class that is controlled by Eclipse, and you don’t have to worry about setting up banners from the lib server, etc.

Hope this helps. Similarly, I just create a test project

+1
source

Yep looks like a jar version clash

Removing application JSF dependencies: If you are building a project using maven, you can set the dependency area .

Remove the dependency region from the JSF (if you want to use your own banks). Consider using the Jboss application description and exclude JSF dependencies.

I do not know the JBoss 5 XML format, so the placement for JBoss 7

 <jboss-deployment-structure> <deployment> <exclusions> <module name="com.sun.jsf-impl" /> </exclusions> </deployment> </jboss-deployment-structure> 

There must be something like this.

0
source

All Articles