我似乎得到以下異常嘗試部署我的應用程序時:java.util.List的是一個接口,而JAXB無法處理接口
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
java.util.List is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at java.util.List
at private java.util.List foobar.alkohol.register.webservice.jaxws.GetRelationsFromPersonResponse._return
at foobar.alkohol.register.webservice.jaxws.GetRelationsFromPersonResponse
java.util.List does not have a no-arg default constructor.
this problem is related to the following location:
at java.util.List
at private java.util.List foobar.alkohol.register.webservice.jaxws.GetRelationsFromPersonResponse._return
at foobar.alkohol.register.webservice.jaxws.GetRelationsFromPersonResponse
我的代碼工作得很好,直到我改變從列表中返回類型列出清單< <RelationCanonical> >
下面是部分Web服務:
@Name("relationService")
@Stateless
@WebService(name = "RelationService", serviceName = "RelationService")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public class RelationService implements RelationServiceLocal {
private boolean login(String username, String password) {
Identity.instance().setUsername(username);
Identity.instance().setPassword(password);
Identity.instance().login();
return Identity.instance().isLoggedIn();
}
private boolean logout() {
Identity.instance().logout();
return !Identity.instance().isLoggedIn();
}
@WebMethod
public List<List<RelationCanonical>> getRelationsFromPerson(@WebParam(name = "username")
String username, @WebParam(name = "password")
String password, @WebParam(name = "foedselsnummer")
String... foedselsnummer) {
......
......
......
}
我也嘗試通過刪除@SOAPBinding並嘗試默認,但會發生相同的結果。 感謝所有幫助
UPDATE
我要指出了一些東西。我將所有List更改爲ArrayList,然後編譯。我說爲什麼編譯而不工作是因爲它表現奇怪。我得到一個類型爲Object的對象: RelationServiceStub.ArrayList 但該對象沒有get方法或者不像List那樣工作。我也試圖把它放到一個列表中,但沒有奏效。
請注意,這是我使用Axis 2和wsdl2java之後所以是的,現在它編譯,但我不知道如何獲取數據。
是的,我在我做這個問題已經提到的,但它仍然沒有奏效。閱讀更新 – 2013-09-13 13:01:04