CXF:java.lang.AbstractMethodError:org.apache.xerces.dom.ElementNSImpl.setUserData

来源:互联网 发布:win10蓝牙 浏览软件 编辑:程序博客网 时间:2024/05/22 02:13

前言:

      在一个JavaWeb项目中,要接入WebService时,使用CXF,但是接入的时候出现异常:

java.lang.AbstractMethodError: org.apache.xerces.dom.ElementNSImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object;at org.apache.cxf.staxutils.StaxUtils.addLocation(StaxUtils.java:1133)at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1021)at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:994)at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:921)at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)

解决过程:

      根据网上查找的答案,是因为xerces-2.6.2.jar这个jar包冲突,将xerces升级到2.8以上版本就不会有这个问题。

      1、将xerces-2.6.2.jar从项目中删除。

     

      2、因为本项目是maven项目,直接在pom.xml中添加2.8版本的xerces依赖

<dependency>     <groupId>xerces</groupId>     <artifactId>xercesImpl</artifactId>     <version>2.8.0</version></dependency>

      3、重新运行项目,异常解决成功!



阅读全文
0 0
原创粉丝点击