我正在将 Web 应用程序迁移到 JBoss AS 7.1.1.Final。该应用程序的结构如下:
app.ear
|--- \lib
| |-- jsf-api-2.0.2.jar, jsf-impl-2.0.2.jar, jsp-api-2.1.jar, jstl-1.2.jar
|
|--- \META-INF
|--- \web.war
| |-- \WEB-INF
| | |-- web.xml
| |
|
|--- \ejbs.jar
正如我们所见,这个应用程序使用了 jsf 实现 Mojarra 2.0.2 (FCS b10)。文件 jsf-impl-2.0.2.jar 和 jsf-api-2.0.2.jar 位于 EAR 根目录的 \lib 中。
在 web.xml 中,我添加了参数,它告诉服务器正在使用的实现是与应用程序捆绑的实现:
--web.xml:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
此外,添加了文件jboss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclusions>
<!-- Exclude container version of hibernate. By default its version 4,
we want bundled version 3 loaded -->
<module name="org.hibernate" slot="main" />
<module name="org.hibernate.validator" slot="main" />
<module name="javax.faces.api" slot="main" />
<module name="com.sun.jsf-impl" slot="main" />
<module name="javax.faces.api" slot="1.2" />
<module name="com.sun.jsf-impl" slot="1.2" />
</exclusions>
<dependencies>
<!-- Add dependencies, since in 'pom.xml' we exclude transitive dependencies
from reactor, we need to add following modules, to make application work
properly -->
<!-- NOTE: module name does not always correspond to maven artifact ID -->
<!-- Add dependency on commons.logging -->
<module name="org.apache.commons.logging" />
<!-- Add dependency on commons.collections -->
<module name="org.apache.commons.collections" />
<module name="org.apache.commons.lang" />
<!-- Add dependency on log4j -->
<module name="org.apache.log4j" export="true"/>
<!-- Add dependency on dom4j -->
<module name="org.dom4j" />
<!-- Add dependency on slf4j -->
<module name="org.slf4j" />
<!-- Add dependency on antlr -->
<module name="org.antlr" />
<!-- Add dependency on asm -->
<module name="asm.asm" />
<!-- Add dependency on javassist -->
<module name="org.javassist" />
<module name="org.hibernate" slot="3" />
<module name="org.hibernate.validator" slot="3" />
</dependencies>
</deployment>
尝试部署此应用程序时,服务器会引发以下异常:
17:39:00,826 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (MSC service thread 1-8) JSF1051: Service entry 'org.jboss.as.web.deployment.jsf.JsfInjectionProvider' does not extend DiscoverableInjectionProvider. Entry will be ignored.17:39:00,828 INFO [javax.enterprise.resource.webcontainer.jsf.application] (MSC service thread 1-8) JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
17:39:00,903 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Unsanitized stacktrace from failed start...: javax.faces.FacesException: java.util.concurrent.ExecutionException: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:411) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:328) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:334) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:223) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:335) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
Caused by: java.util.concurrent.ExecutionException: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222) [rt.jar:1.6.0_07]
at java.util.concurrent.FutureTask.get(FutureTask.java:83) [rt.jar:1.6.0_07]
at com.sun.faces.config.ConfigManager.getAnnotatedClasses(ConfigManager.java:407) [jsf-impl-2.0.2.jar:2.0.2-FCS]
... 16 more
Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(AnnotationProviderFactory.java:74) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:764) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:736) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_07]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_07]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:329) [jsf-impl-2.0.2.jar:2.0.2-FCS]
... 9 more
17:39:00,931 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/war]] (MSC service thread 1-8) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:354) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(AnnotationProviderFactory.java:74) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:764) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.call(ConfigManager.java:736) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_07]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_07]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:329) [jsf-impl-2.0.2.jar:2.0.2-FCS]
... 9 more
17:39:00,948 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-8) Error listenerStart
17:39:00,949 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-8) Context [/war] startup failed due to previous errors
17:39:00,952 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804) [jsf-api-2.0.2.jar:2.0.2-FCS]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306) [jsf-api-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:104) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:309) [jsf-impl-2.0.2.jar:2.0.2-FCS]
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3489) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3999) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3917) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
17:39:00,968 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.web.deployment.default-host./war: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./war: JBAS018040: Failed to start context
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
我做了很多研究,但没有解决这个问题。有人知道出路吗?