玻璃鱼4号球衣2.22。CDI1x ClassCastException 请考虑以下问题。 尝试在GlassFish 4.1.1(JavaEE7完整平台)上部署我的简单REST应用程序时,我遇到了下面指定的错误。我的应用程序包含glassfish-web.xml,用于配置类加载委派,以便应用程序使用自己的jersey捆绑包,即版本2.22

玻璃鱼4号球衣2.22。CDI1x ClassCastException 请考虑以下问题。 尝试在GlassFish 4.1.1(JavaEE7完整平台)上部署我的简单REST应用程序时,我遇到了下面指定的错误。我的应用程序包含glassfish-web.xml,用于配置类加载委派,以便应用程序使用自己的jersey捆绑包,即版本2.22,glassfish,jersey-2.0,Glassfish,Jersey 2.0,我得到的错误如下: [2016-03-28813:30:58.035-0400][glassfish 4.1][Severy][[javax.enterprise.web][tid:_ThreadID=43 _ThreadName=admin listener(3)][timeMillis:1459186258035][levelValue:1000][[ WebModule[/device backend]Servlet/设备后端引发加载()异常 java.lang.ClassCastExce

我得到的错误如下:

[2016-03-28813:30:58.035-0400][glassfish 4.1][Severy][[javax.enterprise.web][tid:_ThreadID=43 _ThreadName=admin listener(3)][timeMillis:1459186258035][levelValue:1000][[ WebModule[/device backend]Servlet/设备后端引发加载()异常 java.lang.ClassCastException:无法将org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalException InterceptorProvider强制转换为org.glassfish.jersey.server.spi.ComponentProvider 位于java.lang.Class.cast(Class.java:3186)

pom对Jersey的依赖性如下:

<dependency>
    <groupId>org.glassfish.jersey.containers</groupId>
    <artifactId>jersey-container-servlet</artifactId>
    <version>2.22</version>
</dependency>  
<dependency>
    <groupId>org.glassfish.jersey.containers</groupId>
    <!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core" --> 
    <artifactId>jersey-container-servlet-core</artifactId>
    <version>2.22</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.bundles</groupId>
    <artifactId>jaxrs-ri</artifactId>
    <version>2.22</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-json</artifactId>
    <version>1.19</version>
</dependency>

org.glassfish.jersey.containers
jersey容器servlet
2.22
org.glassfish.jersey.containers
jersey容器servlet核心
2.22
org.glassfish.jersey.bundles
杰克斯里
2.22
泽西岛
泽西json
1.19
没有glassfish-web.xml,一切都可以正常部署