【发布时间】:2012-07-22 22:41:45
【问题描述】:
我正在尝试在 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)
我的web.xml 中肯定有xml sn-p。我尝试调试代码,发现javax.faces.FactoryFinder 的第267 行上的registeredFactoryNames 是空的,这会导致错误。然而,我不明白为什么会这样。里面应该有什么,我如何得到它?
有趣的是webapp使用嵌入式jetty 8完美运行。所以它一定是一些依赖问题。
希望对这一切有更深入了解的人可以在这里帮助我。
【问题讨论】:
标签: java tomcat maven jsf-2 maven-tomcat-plugin