Erro java.lang.IllegalStateException: No Factories configured for this Application

3 respostas
M

Criei uma aplicação com MyFaces utilizando netbeans 6 e Sun Java Application, ela funciona sem problemas. Porém quando eu tento rodar no tomcat ele me retorna o seguinte erro:

javax.servlet.ServletException: Servlet.init() for servlet Faces Servlet threw exception
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Unknown Source)

root cause

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.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

	javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
	javax.faces.webapp.FacesServlet.init(FacesServlet.java:88)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	java.lang.Thread.run(Unknown Source)

Alguem tem alguma ideia?

Desde já agradeço. Obrigado

3 Respostas

C

e ai, niquem sabe nada desse erro?
tb to com o mesmo problema :thumbdown:

J

Eu também… acho que é algum padrão do J2EE que não estamos seguindo direito… =/

W

Post antigo, mas … vamos lá,
Existe um artifício técnico para resolver este problema:

mudar:

<servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
Para:

<servlet>
	<servlet-name>Faces Servlet</servlet-name>
	<servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class>
	<load-on-startup>1</load-on-startup>
	</servlet>
Criado 5 de outubro de 2007
Ultima resposta 24 de out. de 2011
Respostas 3
Participantes 4