Java com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:2次illegalannotationException计数
我的ApacheCxf客户端web服务出现异常,如下所示。但是,“XML类型名称“address”是我的WSDL的soap:address位置。有什么问题Java com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:2次illegalannotationException计数,java,web-services,jaxb,cxf,Java,Web Services,Jaxb,Cxf,我的ApacheCxf客户端web服务出现异常,如下所示。但是,“XML类型名称“address”是我的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.
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
也没有注释,但是有一个包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
中是否有包info.java
- 您在
com.sun.xml.ws.developer
中有吗
- 尝试更新库的版本。这可能是版本之间的临时故障
更新
我发现了完全相同的问题。发布的解决方案之一基本上是“更新您的版本”。似乎也与NetBeans有某种关联。共享部分代码和WDSL。但例外情况非常明显。两个类用相同的名称属性(“address”)注释。实际上没有address属性。此地址只是WSDLs的soap地址本地化。我已经解决了这个问题。当您将spring+jaxws用于服务器端服务,将apache+cxf用于另一个客户端服务时,WSDLs的endpoint address属性将发生冲突。因此,我将apache cxf+spring用于这两个服务。Thanks很多为什么不把你的评论作为答案,这样问题就不会一直没有答案,以后可能会对其他人有所帮助。谢谢:)这很有帮助我使用apache cxf+spring提供这两种服务。并使用不同的开发策略跳过了问题