Liberty上的Bluemix Web应用程序在运行时抛出ClassCastExceptions

时间:2015-11-24 15:24:55

标签: java ibm-cloud websphere-liberty

我在Bluemix Liberty上运行的应用程序已经开始在服务的每个http请求上抛出一个ClassCastException。 Bluemix环境有什么变化吗?

 class com.qw.psence.core.servlet.SkipListController class 
    com.qw.psence.core.servlet.ContactController [INFO ] FFDC1015I: An FFDC Incident has been created: "java.lang.ClassCastException: 
    org.jboss.weld.manager.BeanManagerImpl incompatible with 
    com.sun.jersey.server.impl.cdi.CDIExtension 
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init 181" at 
    ffdc_15.09.19_09.53.35.0.log at 
    com.sun.jersey.server.impl.cdi.CDIExtension.getInitializedExtension(CDIExtension.java:180) 
    [ERROR ] SRVE0271E: Uncaught init() exception created by servlet [jersey-serlvet] in application [myapp]: java.lang.ClassCastException: 
    org.jboss.weld.manager.BeanManagerImpl incompatible with 
    com.sun.jersey.server.impl.cdi.CDIExtension at 
    javax.servlet.GenericServlet.init(GenericServlet.java:244) at 
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java
    :394) at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.(CDIComponentProviderFactory.java:95) at 
    com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize
    (CDIComponentProviderFactoryInitializer.java:76) at 
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577) at 
com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:572) at [internal classes] at 
    com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:332) at 
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) at 
    com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:604) at 
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332) at 
    [internal classes] at 
    com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:572) at 
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:401) at 
    com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:332) 
    [ERROR ] SRVE0276E: Error while initializing Servlet [jersey-serlvet]: 
    javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet at 
    com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:604) at 
    com.sun.jersey.server.impl.cdi.CDIExtension.getInitializedExtension(CDIExtension.java:180) Caused by: java.lang.ClassCastException: 
    org.jboss.weld.manager.BeanManagerImpl incompatible with com.sun.jersey.server.impl.cdi.CDIExtension at 
    com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) at 
    com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:76) ... 1 more at 
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394) at javax.servlet.GenericServlet.init(GenericServlet.java:244) at 
    com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577) at 
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332) at 
    com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.
    (CDIComponentProviderFactory.java:95)

1 个答案:

答案 0 :(得分:1)

Bluemix运行时最近已更新为Liberty buildpack v2。为了消除所有类加载问题,请尝试将您的应用作为独立应用程序推送:

 cf push <yourappname> -p myapp.war

server.xml文件现在包含许多用于推送独立应用程序的更新功能(即jaxrs-2.0)。

如果要使用buildpack的先前版本,请使用以下命令执行此操作:

cf push appName -p myapp.war -b liberty-for-java-v1

此博客文章解释了Liberty for Java buildpack中的更改:

https://developer.ibm.com/bluemix/2015/09/08/upcoming-liberty-for-java-buildpack-changes/