我似乎得到以下异常尝试部署我的应用程序时: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