我的 apache cxf 客户端 Web 服务出现异常,如下所示。但是,“XML 类型名称“地址””是我的 WSDL 的 soap:address 位置。问题是什么?
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.Address
类没有注释,也没有 package-info.java
。所以类型应该命名为address
,没有命名空间。
javax.xml.ws.wsaddressing.W3CEndpointReference.Address
类也没有注释,但是有一个package-info.java
:
@javax.xml.bind.annotation.XmlSchema(namespace=W3CEndpointReference.NS,
location="http://www.w3.org/2006/03/addressing/ws-addr.xsd")
package javax.xml.ws.wsaddressing;
所以它应该被命名为{http://www.w3.org/2005/08/addressing:address
。所以理论上应该不会有冲突。
我建议如下:
- 检查你的类和包。
javax.xml.ws.wsaddressing
中是否有package-info.java
?com.sun.xml.ws.developer
中有吗?
- 尝试更新您的库版本。也许这是版本之间的临时故障。
更新
我发现了完全相同的问题reported on java.net .那里发布的解决方案之一基本上是“更新您的版本”。似乎也以某种方式与 NetBeans 相关。
关于java - com.sun.xml.bind.v2.runtime.IllegalAnnotationsException : 2 counts of IllegalAnnotationExceptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15680663/