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

前言:

      在一個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、重新運行項目,異常解決成功!



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章