我想在Tomcat 6网络服务器上使用Apache MyFaces 2.1.7运行JSF 2.0 webapp。该应用使用了Tomahawk 1.1.11和表达式语言2.2(el-impl-2.2.jar)。为此,我将myfaces-api和myfaces-impl放入了Tomcats的lib文件夹,并将2.2版本的Tomcats el-api.jar进行了交换。Tomcat 6下的JSF 2.0应用程序:“未配置工厂”。
当我调用应用程序的第一页,我总是得到错误:
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:286)
javax.faces.FactoryFinder.getFactory(FactoryFinder.java:206)
javax.faces.webapp.FacesServlet.init(FacesServlet.java:116)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:679)
我绝对有XML片段在我web.xml
提及。我试图调试到代码中,发现javax.faces.FactoryFinder
的第267行上的registeredFactoryNames
是空的,导致错误。然而,我不明白为什么会出现这种情况。那里应该有什么,我该如何得到它?
有趣的是,webapp运行完美,使用嵌入式jetty 8.所以它必须是一些依赖性问题。
希望有更多的人了解这一切可以帮助我在这里。
其实我在'WEB-INF'里有一个空的faces-config.xml。如果情况不是这样的话,该应用不会在码头下运行。 – ali 2012-07-25 17:41:03
尝试tomcat:run-war – lu4242 2012-07-25 18:31:36
我认为这不会有帮助,因为这会调用旧的tomcat插件。使用tomcat6:run或tomcat7:run来调用新的。这就像一个魅力。我认为这个问题实际上与maven插件无关,但与满足依赖关系有关。我用最新的研究编辑了这个问题。 – ali 2012-07-25 19:18:45