答:只有当它无法加载 com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl (在 com.ibm.jaxb.tools.jar 中)
要看到这一点,在上下文对象上调用 toString() 很有用:
Primary JAXBContext:
bundleresource://138.fwk797973828/com/ibm/xml/xlxp2/jaxb/JAXBContextImpl.class,
Version: 1.6.2-jaxb,
Timestamp: Tue, 18 Oct 2016 17:08:48 EDT,
Classes known to this context:
[NONE] (Fallback JAXBContext will be used to process any requests.)
Fallback JAXBContext:
bundleresource://11.fwk797973828/com/ibm/jtc/jax/xml/bind/v2/runtime/JAXBContextImpl.class Build-Id: null
所以 XLXP 使用 com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl。
现在,com.ibm.xml.xlxp.jaxb.opti.level=0
设置:
Primary JAXBContext:
bundleresource://138.fwk-1179731101/com/ibm/xml/xlxp2/jaxb/JAXBContextImpl.class,
Version: 1.6.2-jaxb,
Timestamp: Tue, 18 Oct 2016 17:08:48 EDT,
Classes known to this context:
[NONE] (Fallback JAXBContext will be used to process any requests.)
Fallback JAXBContext:
bundleresource://11.fwk-1179731101/com/ibm/jtc/jax/xml/bind/v2/runtime/JAXBContextImpl.class Build-Id: null
也就是说,没有变化!IBM JAXB 仍在使用中。
尝试改变这种情况的两种方法:
- com.ibm.ws.prereq.xlxp.jar/META-INF/services/com.ibm.xml.xlxp.jaxb.fallback.context 包含 com.ibm.jtc.jax.xml.bind.v2.ContextFactory;我们可以在里面放点别的东西
- 删除 com.ibm.jaxb.tools.jar
我尝试删除 com.ibm.jaxb.tools.jar。重启 WAS 后:
Primary JAXBContext:
bundleresource://138.fwk-218185936/com/ibm/xml/xlxp2/jaxb/JAXBContextImpl.class,
Version: 1.6.2-jaxb,
Timestamp: Tue, 18 Oct 2016 17:08:48 EDT,
Classes known to this context:
[NONE] (Fallback JAXBContext will be used to process any requests.)
Fallback JAXBContext:
jar:file:/home/jharrop/IBM/WebSphere/AppServer/java/8.0/jre/lib/rt.jar!/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.class Build-Id: 1.8.0
如此有趣的是,如果您删除 com.ibm.jaxb.tools.jar,com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl 就在那里(至少在我的安装中)并被使用!所以我想你可以改为在 com.ibm.ws.prereq.xlxp.jar/META-INF/services/com.ibm.xml.xlxp.jaxb.fallback.context 中指定它
如果您确实尝试删除 com.ibm.jaxb.tools.jar,当您重新添加它时,请记住清除类缓存以便 WAS 再次找到它(停止服务器,运行 bin/clearClassCache):http:// www-01.ibm.com/support/docview.wss?uid=swg21607887
WebSphere 8.5.5.13(使用 IBM Java 1.8.0_151 - 安装多么痛苦!)看起来很相似。