javax.faces.context.FacesContextFactory。试图找到备份

时间:2015-05-22 15:57:29

标签: java jsf

我在jboss 6.2.4中部署应用程序。 但是当我打开索引页面时它会返回此错误:

10:36:21,808 SEVERE [javax.faces] (ServerService Thread Pool -- 1563) La aplicación no se ha inicializado correctamente durante el inicio, no se encuentra la fábrica: javax.faces.context.FacesContextFactory. Attempting to find backup.
10:36:21,809 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/auditoria-migracion]] (ServerService Thread Pool -- 1563) JBWEB000289: Servlet Faces Servlet threw load() exception: java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. 
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:996) [jsf-api-2.0.10.jar:2.0.10-SNAPSHOT]
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:331) [jsf-api-2.0.10.jar:2.0.10-SNAPSHOT]
    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:219) [jsf-api-2.0.10.jar:2.0.10-SNAPSHOT]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1194) [jbossweb-7.3.2.Final-redhat-1.jar:7.3.2.Final-redhat-1]
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1100) [jbossweb-7.3.2.Final-redhat-1.jar:7.3.2.Final-redhat-1]
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3591) [jbossweb-7.3.2.Final-redhat-1.jar:7.3.2.Final-redhat-1]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3798) [jbossweb-7.3.2.Final-redhat-1.jar:7.3.2.Final-redhat-1]
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.3.4.Final-redhat-1.jar:7.3.4.Final-redhat-1]
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.3.4.Final-redhat-1.jar:7.3.4.Final-redhat-1]
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.3.4.Final-redhat-1.jar:7.3.4.Final-redhat-1]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_25]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_25]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

10:36:21,897 INFO  [org.jboss.as.server] (management-handler-thread - 140) JBAS018559: Implementado "auditoria-migracion-3.0.war" (runtime-name : "auditoria-migracion.war")

我已将这些罐子添加到项目中:

  • jsf-api-2.0.10.jar
  • JS​​F的参数impl-2.0.10.jar
  • JS​​TL-1.2.jar

在jboss-deployment-structure.xml中我已经排除了jboss jsf库以便在app lib中获取jar:

<exclusions>
    <module name="javax.api" />
    <module name="javax.faces.api" />
    <module name="org.hibernate" slot="main"/>  

    <module name="org.slf4j" />
    <module name="org.slf4j.impl" />
    <module name="javaee.api" />
    <module name="javax.jsf-impl" slot="main" />
    <module name="javax.jsf-impl" slot="1.2" />
    <module name="javax.jsf-api" slot="main" /> 
</exclusions>
<dependencies>

    <module name="org.apache.commons.digester" export="true" /> 
    <module name="org.hibernate" slot="3" export="true" />          
    <module name="javaee.api" export="true" />                  
    <module name="deployment.auditoria.ear" export="true" />        
    <module name="deployment.cliente-notificaciones.jar" export="true" />   

</dependencies>

为什么我收到此错误?

1 个答案:

答案 0 :(得分:0)

问题是jboss 6在系统模块中有更多的jsf apis,所以我必须在jboss-deployment-structure.xml中排除所有这些

<exclusions>
            <module name="javax.api" />
            <module name="javax.faces.api" />
            <module name="org.hibernate" slot="main"/>  

            <module name="org.slf4j" />
            <module name="org.slf4j.impl" />
            <module name="javaee.api" />
            <module name="javax.jsf-impl" slot="main" />
            <module name="javax.jsf-impl" slot="1.2" />
            <module name="javax.jsf-api" slot="main" /> 
            <module name="javax.faces.api" slot="main" />   
            <module name="javax.faces.api" slot="1.2" />    
            <module name="org.jboss.as.jsf" />
            <module name="com.sun.jsf-impl" slot="1.2" />
            <module name="com.sun.jsf-impl" slot="main" />



        </exclusions>