If you’ve received the “No Factories configured for this Application” error with MyFaces 1.2, then you’re not alone.
Detailed message goes like this:
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!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
The weirdest thing is that I have the context listener declared in my web.xml!
<listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener>
From what I’ve gathered, changing the web.xml entry
<servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
<servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
should do the trick.
But then again, moving to 1.2.2 of MyFaces also makes the problem go away. (at least that was the case when I upgraded to 1.2.2).
So my suggestion is to just upgrade the version of your MyFaces jars instead of going with the rather “hacky” solution.