我正在尝试在 Tomcat 6 网络服务器上使用 Apache MyFaces 2.1.7 运行 JSF 2.0 网络应用程序。该应用程序使用 Tomahawk 1.1.11 和表达式语言 2.2 (el-impl-2.2.jar)。为此,我将 myfaces-api 和 myfaces-impl 放入 Tomcats lib 文件夹,并将 Tomcats el-api.jar 交换为 2.2 变体。
当我调用应用程序的第一页时,我总是收到错误消息:
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 文件中提到的 xml 片段web.xml
。我试图调试代码,发现registeredFactoryNames
第 267 行javax.faces.FactoryFinder
是空的,这会导致错误。然而,我不明白为什么会这样。那里应该有什么,我如何得到它?
有趣的是,webapp 使用嵌入式 jetty 8 完美运行。所以它一定是一些依赖问题。
希望对所有这些有更深入了解的人可以在这里帮助我。