javax.faces.FacesException:类org.jboss.as.jsf.injection.JandexAnnotationProvider不是com.sun.faces.spi.AnnotationProvider的实例

时间:2015-05-21 08:45:38

标签: jsf wildfly mojarra

我使用:Maven 3.3.1,Java SE 1.8,JavaServerFaces 2.2,JPA 2.0,Spring 4.1.6,Hibernate 4.3.2.Final和Wildfly。 我是J2EE的新手,请给我详细说明。

我的堆栈跟踪:

     09:52:31,461 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class org.jboss.as.jsf.injection.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:357) [javax.faces-2.0.10.jar:2.0.10-SNAPSHOT]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:220) [javax.faces-2.0.10.jar:2.0.10-SNAPSHOT]
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
    Caused by: javax.faces.FacesException: Class org.jboss.as.jsf.injection.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(AnnotationProviderFactory.java:78) [javax.faces-2.0.10.jar:2.0.10-SNAPSHOT]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.<init>(ConfigManager.java:752) [javax.faces-2.0.10.jar:2.0.10-SNAPSHOT]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:330) [javax.faces-2.0.10.jar:2.0.10-SNAPSHOT]
... 10 more

    09:52:31,472 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./Ear_Project: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./Ear_Project: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
     Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class org.jboss.as.jsf.injection.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:222)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
    Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class org.jboss.as.jsf.injection.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:287)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193)
... 7 more
    Caused by: com.sun.faces.config.ConfigurationException:   CONFIGURATION FAILED! Class org.jboss.as.jsf.injection.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:357)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:220)
... 9 more
    Caused by: javax.faces.FacesException: Class org.jboss.as.jsf.injection.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(AnnotationProviderFactory.java:78)
at com.sun.faces.config.ConfigManager$AnnotationScanTask.<init>(ConfigManager.java:752)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:330)
... 10 more

1 个答案:

答案 0 :(得分:0)

JandexAnnotationProvider实际上从AnnotationProvider类扩展,如果两个类都是通过不同的类加载器加载的,则可能会导致此类错误。

我认为您必须从您的应用程序中排除jsf-api-???.jarjsf-impl-???.jar。使用应用程序服务器提供的jsf库。

要使用maven实现它,只需将<scope>provided</scope>设置为jsf-api

中的jsf-implpom.xml依赖项