【发布时间】:2019-08-16 20:39:41
【问题描述】:
我已经解决这个问题两天了。我需要帮助
我正在运行 Spring mvc,一切看起来。我将另一个 web 服务的客户端添加为依赖项,然后当我尝试测试时,我得到了这个异常。
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
at javax.xml.ws.wsaddressing.W3CEndpointReference
Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
at javax.xml.ws.wsaddressing.W3CEndpointReference
进一步分析,我发现这些冲突(地址/元素)存在于属于我的依赖项之一的类 com.sun.xml.ws.developer.MemberSubmissionEndpointReference
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.5</version>
它所属的另一个类 javax.xml.ws.wsaddressing.W3CEndpointReference 可能在我的依赖项中的客户端中。
我该如何解决这个问题!!它们不是我的课程,所以我无法修改它们。我不知道该怎么办。我尝试了排除、绑定..等,但没有任何效果
编辑:
我使用 Eclipse for IDE 和 websphere 作为应用服务器。这是冲突的 2 个 xml 依赖项
XML1:
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.5</version>
XML2:
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.5</version>
</dependency>
如果我将 xml1 升级到 2.3.5,那么问题就消失了,但问题是 2.3.5 在 Java 8 中被编译,而我的应用程序的其余部分是 Java 7(我被工作锁定)并且它正在抛出兼容性错误。所以我正在寻找其他方法来解决它
【问题讨论】:
-
你可以发布maven依赖吗?
-
如果您发帖,我认为每个人都会得到更好的帮助。您的 IDE、应用程序服务器和您的 pom.xml 与假定的冲突依赖项是什么
-
@HassamAbdelillah 请查看编辑后的答案