3
votes

I have created web dynamic project with jsf2, Primefaces 3.4, Tomcat7.Application runs fine. If i deploy the EAR of the same project on Websphere8 instead of Tomcat7, I am getting Exceptions.I am not sure of what is happening. I am new to JSF2 and Wepshere8.

can you provide me the links on how to start sample jsf2 + primefaces project on Websphere 8

Thanks in advance.

4
what is the exception you get? can you share that? - Harish Raj
hello harish.raj java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions! - shreekanth
A typical config looks like this; <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:196) at org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131) at - shreekanth
In future questions, never ignore exceptions as if they are decoration. They represent namely the whole answer to the concrete problem. If you are not capable to interpret them, you should not ignore them, but copypaste them in their entirety into your question. This way we can translate them for you in layman's terms, so that you should be able to solve the problem based on the information provided in the exception. - BalusC

4 Answers

1
votes

Got it. Try to add com.sun.faces.config.ConfigureListener instead of org.apache.myfaces.webapp.StartupServletContextListener in your web.xml, restart your server and then run it.

The code should look like the following.

<listener>  
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>  
</listener> 
1
votes

For using different implementations of JSF, the WebSphere Application Server JSF engine determines if the SUN RI or Apache MyFaces is used from the application server run time. After the JSF engine determines the implementation that is used, the correct listener class is registered with the web container. You do not need to add the com.sun.faces.ConfigureListener or the org.apache.myfaces.StartupConfigureListener to the web.xml file.

http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/cweb_javaserver_faces.html

Please see above...

1
votes

I too faced the same problem. Websphere by default support sun impl and apache myfaces and its jsf 1.2.

To use jsf 2 implementation.

1.Make sure to remove servlet.jar from your application.Its need for tomcat however not in websphere.

2.Change the classloader policy for ear to parent last.Parent last means lib in your app will have higher priority.if not found will load from WAS class path.

3.Also make sure to change the webmodule class loader policy to parent last.

4.Restart websphere.

-2
votes

To solve the classloader of primefaces in websphere 8.5 classes replace the jsf jsf-api jsf-impl javaee-api for the native implementation of websphere myfaces-api myfaces-impl