weblogic javax/xml/namespace/QName报错

项目从Tomcat迁移到Weblogic时出现错误,原因是Weblogic中旧的jar包与Apache CXF冲突导致LinkageError。解决方法是通过ifind.jar工具删除工程中所有包含javax/xml/namespace/QName类的文件,并设置prefer-web-inf-classes为true,以优先使用web/lib下的包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

项目在tomcat已调试好,部署到weblogic后报错,如下

org.springframework.beans.factory.Bea
nCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the referring class, javax/xml/datatype/DatatypeConstants, and the class loader (instance of <bootloader>) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type

分析:应该是属于jar包问题,工程需要设置weblogic.xml优先用web/lib下面的包

<weblogic-web-app>
    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
        </container-descriptor>
  </weblogic-web-app> 

因为 Apache CXF 里的类的时间晚于 Weblogic 里的类的时间,而且类的二进制内容也发生了改变,
于是原来 Weblogic 里的其它类由于我们通过了 prefer-web-inf-classes 设置为 true 后,而引用到了现在的 Apache CXF 里的类了,就发生了 java.lang.LinkageError 错误。

解决方式是使用ifind.jar工具把工程下所有带javax/xml/namespace/QName class的都删除掉。
ifind.jar工具下载地址: http://pan.baidu.com/s/1dEBCGN3

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值