我在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")
我已经将这些jar文件添加到项目中:
- jsf-api-2.0.10.jar
- jsf-impl-2.0.10.jar
- jstl-1.2.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>
为什么我得到这个错误?
问题是jboss 6在系统模块中有更多的jsf api,所以我必须在jboss-deployment-structure.xml
中排除所有这些api<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>