java.lang.ClassCastException:org.jboss.weld.manager.BeanManagerImpl与com.sun.jersey.server.impl.cdi.CDIExtension不兼容

时间:2016-06-09 22:38:08

标签: java-ee jax-rs websphere cdi classcastexception

我正在使用Websphere liberty profile来部署我的其余api。当我尝试测试我的api时,我看到以下错误消息。我不知道这个jboss类正在形成的地方。我确实没有找到任何与JBOSS相关的文件。  任何人都可以解释这些Jboss错误来自哪里

[ERROR   ] SRVE0271E: Uncaught init() exception created by servlet [REST Service] in application [gmc]: java.lang.ClassCastException: org.jboss.weld.manager.BeanManagerImpl incompatible with com.sun.jersey.server.impl.cdi.CDIExtension
    at com.sun.jersey.server.impl.cdi.CDIExtension.getInitializedExtension(CDIExtension.java:180)
    at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.<init>(CDIComponentProviderFactory.java:95)
    at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:76)
    at com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:572)
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:332)
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:604)
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
    at javax.servlet.GenericServlet.init(GenericServlet.java:244)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:330)
    at [internal classes]



[ERROR   ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4898)
        at [internal classes]
    Caused by: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:399)
        ... 1 more
    Caused by: java.lang.ClassCastException: org.jboss.weld.manager.BeanManagerImpl incompatible with com.sun.jersey.server.impl.cdi.CDIExtension
        at com.sun.jersey.server.impl.cdi.CDIExtension.getInitializedExtension(CDIExtension.java:180)
        at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.<init>(CDIComponentProviderFactory.java:95)
        at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:76)
        at com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:572)
        at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:332)
        at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:604)
        at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
        at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
        at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
        at javax.servlet.GenericServlet.init(GenericServlet.java:244)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:330)
        ... 1 more

1 个答案:

答案 0 :(得分:0)

您能否在server.xml中启用以下功能代替其旧版本并查看结果?

<feature>jaxrs-2.0</feature>