java.lang.IllegalStateException:找不到工厂javax.faces.context.FacesContextFactory的备份 [英] java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory

查看:102
本文介绍了java.lang.IllegalStateException:找不到工厂javax.faces.context.FacesContextFactory的备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取java.lang.IllegalStateException:找不到工厂javax.faces.context.FacesContextFactory的备份.当我将Webapp部署为.war时.有谁知道从哪里开始寻找这个问题的根本原因?该应用程序可以在Eclipse IDE中按预期运行,但是当导出该应用程序以进行部署以在公共可用的独立TomEE环境中部署时,它会失败.

I'm getting the java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. when I deploy my webapp as a .war. Does anyone have an idea where to begin looking for the root cause of this problem? The application runs as expected in the Eclipse IDE, but when exported as a war for deploying on the publicly available stand-alone TomEE environment, it fails.

非常感谢.

我的配置: Apache TomEE-WebProfile 1.6.0.2 JSF 2.2.7(com.sun.faces)(Mojarra lib 2.2.0)<-这可能是个问题吗?但是,为什么该应用程序在Eclipse环境中运行而不在独立的TomEE中运行?

My configuration: Apache TomEE - WebProfile 1.6.0.2 JSF 2.2.7 (com.sun.faces)(Mojarra lib 2.2.0) <-- This may be a problem? But why does the app run in the Eclipse environment but not the stand-alone TomEE?

Maven 4.0.0

Maven 4.0.0

java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. 
    javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1004)
    javax.faces.FactoryFinder.getFactory(FactoryFinder.java:316)
    javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
    org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:744)

web.xml:

<web-app 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
    id="WebApp_ID" 
    version="3.0">
  <display-name>ProjName</display-name>
  <welcome-file-list>
    <welcome-file>login.xhtml</welcome-file>
  </welcome-file-list>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
  </context-param>
   <context-param>
        <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
        <param-value>true</param-value>
    </context-param>
  <context-param>
    <param-name>com.sun.faces.forceLoadConfiguration</param-name>
    <param-value>true</param-value>
  </context-param>

  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

.war WEB-INF/lib目录中导出的jar:

The jars that are exported in the .war WEB-INF/lib directory:

WEB-INF/lib/javax.faces.jar
WEB-INF/lib/javax.faces-api-2.2.jar
WEB-INF/lib/jsf-api-2.2.7.jar
WEB-INF/lib/jsf-impl-2.2.7.jar
WEB-INF/lib/poi-3.10-FINAL.jar
WEB-INF/lib/commons-codec-1.5.jar
WEB-INF/lib/poi-ooxml-3.10-FINAL.jar
WEB-INF/lib/poi-ooxml-schemas-3.10-FINAL.jar
WEB-INF/lib/xmlbeans-2.3.0.jar
WEB-INF/lib/stax-api-1.0.1.jar
WEB-INF/lib/dom4j-1.6.1.jar
WEB-INF/lib/xml-apis-1.0.b2.jar
WEB-INF/lib/cxf-bundle-jaxrs-2.7.11.jar
WEB-INF/lib/woodstox-core-asl-4.2.1.jar
WEB-INF/lib/stax2-api-3.1.4.jar
WEB-INF/lib/xmlschema-core-2.1.0.jar
WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar
WEB-INF/lib/wsdl4j-1.6.3.jar
WEB-INF/lib/jaxb-impl-2.1.13.jar
WEB-INF/lib/jetty-server-8.1.14.v20131031.jar
WEB-INF/lib/jetty-continuation-8.1.14.v20131031.jar
WEB-INF/lib/jetty-http-8.1.14.v20131031.jar
WEB-INF/lib/jetty-io-8.1.14.v20131031.jar
WEB-INF/lib/jetty-util-8.1.14.v20131031.jar
WEB-INF/lib/jetty-security-8.1.14.v20131031.jar
WEB-INF/lib/slf4j-api-1.7.6.jar
WEB-INF/lib/geronimo-servlet_3.0_spec-1.0.jar
WEB-INF/lib/javax.ws.rs-api-2.0-m10.jar
WEB-INF/lib/postgresql-9.3-1101-jdbc41.jar
WEB-INF/lib/commons-httpclient-3.1.jar
WEB-INF/lib/commons-logging-1.0.4.jar
WEB-INF/lib/hamcrest-all-1.3.jar
WEB-INF/lib/junit-4.11.jar
WEB-INF/lib/hamcrest-core-1.3.jar
WEB-INF/lib/httpclient-4.3.3.jar
WEB-INF/lib/httpcore-4.3.2.jar
WEB-INF/lib/commons-dbcp2-2.0.jar
WEB-INF/lib/commons-pool2-2.2.jar
WEB-INF/lib/mockito-core-1.9.5.jar
WEB-INF/lib/objenesis-1.0.jar

推荐答案

我通过从web.xml文件中删除参数来解决了这个问题.

I resolved this by removing the parameter from the web.xml file.

 <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>

删除上面的文本,重新构建,从Eclipse中导出战争,并使用Tomcat Web应用程序管理器UI进行部署解决了该问题.显然,自 http://java.sun.com/xml/ns/javaee/web-app_3_0 .我不知道这是事实,但请在

Removing the above text, rebuilding, exporting the war from Eclipse and deploying with the Tomcat Web Application Manager UI resolved the problem. Apparently, one of the jsf jars has this code built-in since http://java.sun.com/xml/ns/javaee/web-app_3_0 . I don't know this to be a fact, but read it in could not find Factory: javax.faces.context.FacesContextFactory. The difference here being that I removed the parameter instead of adding it.

这篇关于java.lang.IllegalStateException:找不到工厂javax.faces.context.FacesContextFactory的备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆