com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:IllegalAnnotationExceptions的2个计数

时间:2013-03-28 11:31:40

标签: java web-services jaxb cxf

我的apache cxf客户端Web服务异常如下所示。但是,'XML类型名称“地址”'是我的WSDL的soap:地址位置。问题是什么?

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

1 个答案:

答案 0 :(得分:1)

这很有趣。这不是一个完整的答案,但这可能有所帮助。

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。所以理论上应该没有冲突。

我建议如下:

  • 检查您的课程和套餐。
    • package-info.java中有javax.xml.ws.wsaddressing吗?
    • 你在com.sun.xml.ws.developer中有一个吗?
  • 尝试更新库的版本。也许这是版本之间的暂时故障。

<强>更新

我发现了完全相同的问题reported on java.net。其中一个解决方案基本上是&#34;更新您的版本&#34;。似乎也以某种方式与NetBeans相关。