Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util.List是接口, 而 JAXB 无法处理接口。 this problem is related to the following location: at java.util.Listat com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:471) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:303) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139) at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1156) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165) at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:167) at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:111) at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:113) at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:94) ... 73 more
counts of IllegalAnnotationExceptions and JAXB can't handle interfaces
大致意思就是说返回值类型不能是接口类型。
解决方法:将服务端的services接口返回的Map类型的值,改成HashMap.
结论:在做webServices复杂类型值传递时,返回值的类型不要用接口类型。例如(List应该改为ArrayList,Map改为HashMap等)