简体   繁体   中英

CXF Conflicts Xerces Dependency

I have a problem with my cxf dependencies. There is a really huge project that ı working and there are lots of dependencies.

My problem is with xerces dependency. There is no older versions of xerces in my pom files, but i am getting the following exception. Do you have any idea about the problem ?

Caused by: 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:1083)
    at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:971)
    at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:947)
    at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:874)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
    at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)

The cause of this error is existance of older version of Xerces dependencies. It maybe added explicit or it may come from another dependecy. It is easy to solve first case, older version should be changed a never version. (There is no error in the version of 2.11.0)

Dependency conflict may come from another dependency as in my case. Some dependencies may have references to Xerces dependencies. There should be given special attention to dependency hiearachy in the project. JTS dependency has reference to older version of Xerces dependency in my case.

<dependency>
 <groupid>com.vividsolutions</groupid>
 <artifactid>jts</artifactid>
 <version>1.11</version> 
</dependency>

JTS dependency has reference to Xerces 2.4.0 internally. It can be seen in JTS pom.

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

There can be any dependency which can be use Xerces dependency internally. All dependency hierarchy should be traced and older version of Xerces should be excluding as in the followings.

<dependency>
 <groupid>com.vividsolutions</groupid>
 <artifactid>jts</artifactid>
 <version>1.11</version>
        <exclusions>
          <exclusion>
   <groupId>xerces</groupId>
   <artifactId>xercesImpl</artifactId>
   </exclusion>
        </exclusions> 
</dependency>

Open pom file in eclipse and click dependency hiearachy to see other conflicts in the project. Any dependency may cause a conflict.

Multiple dependency of apache xerces may cause this issue. Go to dependency hierarchy tree in your IDE and simply exclude xerces dependency and that should work fine.

Do you have mockrunner-jms dependency in your code? Try to exclude apache xerces transitive dependency from it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM