Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WebSphere Liberty profile JAXBContext ClassCastException_Jaxb_Websphere_Classcastexception_Websphere Liberty - Fatal编程技术网

WebSphere Liberty profile JAXBContext ClassCastException

WebSphere Liberty profile JAXBContext ClassCastException,jaxb,websphere,classcastexception,websphere-liberty,Jaxb,Websphere,Classcastexception,Websphere Liberty,我正在使用WebSphereLiberty概要文件服务器,版本8.5.5.3。我有一只耳朵,可以听多场战争。我将它们全部展开(ear和它内部的模块的战争) 在部署它时,我得到以下类强制转换异常: java.lang.RuntimeException: javax.xml.bind.JAXBException: ClassCastException: attempting to cast bundleresource://67.fwk-1166858817/javax/xml/bind/JAXB

我正在使用WebSphereLiberty概要文件服务器,版本8.5.5.3。我有一只耳朵,可以听多场战争。我将它们全部展开(ear和它内部的模块的战争)

在部署它时,我得到以下类强制转换异常:

java.lang.RuntimeException: javax.xml.bind.JAXBException: 
ClassCastException: attempting to cast bundleresource://67.fwk-1166858817/javax/xml/bind/JAXBContext.class 
to jar:file:/C:/ws/IBM/java_1.7_64/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader.
我认为问题在于没有加载捆绑的
jax-api
jaxb-impl
jar,因此我将
server.xml
添加到
parentLast
类加载选项中:

<enterpriseApplication id="ear-app" location="C:/ws/ear/exploded/ear-app.ear" name="ear-app" >
    <classloader delegation="parentLast" commonLibraryRef="provided-jars" privateLibraryRef="shared-libs"/>
</enterpriseApplication>    
但是我仍然有
ClassCastException
,看起来它仍然在使用
parentFirst
类加载


我发现了其他jaxb ClassCastException线程,但不是在使用Liberty概要文件时发现的。

可能是打字错误,但在您的帖子中,您使用了
delegation=“parentFirst”
而不是
parentLast

您是否检查是否仅更改应用程序的委派,如下所示:

<enterpriseApplication id="ear-app" location="C:/ws/ear/exploded/ear-app.ear" name="ear-app" >
    <classloader delegation="parentLast"/>
</enterpriseApplication> 


有关详细信息,请参见

我通过不使用parentLast解决了这个问题。谢谢你的帮助

您是否尝试从应用程序中删除这些JAR以仅加载服务器类?否,我没有尝试,因为我们需要更新的库版本,而不是WebSphere提供的版本。Liberty拥有
jaxb-2.2
。你需要哪一个?还有,您在
server.xml
中启用了哪些功能?好吧,我还以为Liberty在旧版本上呢。我将删除server.xml中的parentLast。我启用了以下功能:servlet-3.0 wasJmsServer-1.0 wasJmsClient-1.1 jndi-1.0 jdbc-4.0Ow,是的,这是一个输入错误,我使用了parentLast
<enterpriseApplication id="ear-app" location="C:/ws/ear/exploded/ear-app.ear" name="ear-app" >
    <classloader delegation="parentLast"/>
</enterpriseApplication>