问题描述
我的cxf依赖项存在问题。有一个非常庞大的项目,它工作,并有很多依赖。
I have a problem with my cxf dependencies. There is a really huge project that ı working and there are lots of dependencies.
我的问题是xerces依赖。我的pom文件中没有旧版本的xerces,但我收到以下异常。你对这个问题有什么看法吗?
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)
推荐答案
此错误的原因是旧版Xerces依赖项存在。它可能是明确的,也可能来自另一个依赖。它很容易解决第一种情况,旧版本应该改为永不版本。 (2.11.0的版本没有错误)
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)
依赖冲突可能来自另一个依赖,就像我的情况一样。某些依赖项可能引用了Xerces依赖项。应该特别注意项目中的依赖性hiearachy。在我的例子中,JTS依赖引用了旧版本的Xerces依赖。
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依赖在内部引用了Xerces 2.4.0。它可以在JTS pom中看到。
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>
可以有任何依赖,可以在内部使用Xerces依赖。应跟踪所有依赖关系层次结构,并应排除旧版本的Xerces,如下所示。
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>
在eclipse中打开pom文件并单击依赖性hiearachy以查看项目中的其他冲突。任何依赖都可能导致冲突。
Open pom file in eclipse and click dependency hiearachy to see other conflicts in the project. Any dependency may cause a conflict.
这篇关于CXF冲突Xerces依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!