weblogic javax/xml/namespace/QName报错

来源:互联网 发布:java ftpclient linux 编辑:程序博客网 时间:2024/05/16 07:08

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

org.springframework.beans.factory.BeanCreationException: 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

0 0
原创粉丝点击