2013-03-28 75 views
2

我的apache cxf客戶端web服務得到了如下所示的異常。但是,「XML類型名稱」地址「」是我的WSDL的soap:地址位置。問題是什麼?com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:2個IllegalAnnotationExceptions計數

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 
+0

分享您的部分代碼和WDSL。但例外情況非常清楚。兩個類使用相同的名稱屬性(「地址」)註釋。 – DiogoSantana 2013-03-28 18:00:01

+0

其實沒有地址屬性。這個地址只是WSDLs的soap地址。我已經解決了這個問題。當你使用服務器端服務的spring + jaxws和另一個客戶端服務使用apache + cxf時,WSDL的端點地址屬性會產生衝突。 THUS,我爲這兩種服務都使用了apache-cxf + spring。非常感謝 – chuck 2013-04-09 16:36:49

+0

爲什麼你不把你的評論作爲答案,所以這個問題不會留下未解答的問題,以後可能會有所幫助。 – DiogoSantana 2013-04-09 21:19:01

回答

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.javajavax.xml.ws.wsaddressing?你有com.sun.xml.ws.developer嗎?
  • 嘗試更新您的庫的版本。也許這是版本之間的暫時故障。

UPDATE

我已經找到完全相同的問題reported on java.net。其中一個解決方案基本上是「更新你的版本」。也似乎與NetBeans有關。

+0

我用這兩種服務的apache-cxf + spring。並採用不同的發展策略來跳過問題 – chuck 2014-10-15 14:04:14