When doing Webservice, the error java.util.List is an interface, and JAXB cannot handle the interface.

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.util.List is an interface and JAXB cannot handle an interface.
this problem is related to the following location:
at java.util.List

at 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

The general meaning is that the return value type cannot be an interface type.

Solution: Change the value of the Map type returned by the services interface of the server to HashMap.
Conclusion: When doing complex type value transfer of webServices, the type of the return value should not use the interface type. For example (List should be changed to ArrayList, Map should be changed to HashMap, etc.)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324514704&siteId=291194637