报错:java.util.Map is an interface, and JAXB can't handle interfaces.

来源:互联网 发布:淘宝被同行刷直接访问 编辑:程序博客网 时间:2024/05/29 18:13
严重: Context [/cgf_service] startup failed due to previous errors    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:330)    ... 68 moreCaused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptionsjava.util.Map is an interface, and JAXB can't handle interfaces.    this problem is related to the following location:        at java.util.Map        at private java.util.Map org.sklse.management.service.jaxws_asm.InvokeServiceMethod2.transportData        at org.sklse.management.service.jaxws_asm.InvokeServiceMethod2java.util.Map does not have a no-arg default constructor.    this problem is related to the following location:        at java.util.Map        at private java.util.Map org.sklse.management.service.jaxws_asm.InvokeServiceMethod2.transportData        at org.sklse.management.service.jaxws_asm.InvokeServiceMethod2

解决方法:将服务端的services接口返回的Map类型的值改为HashMap.
因为在做webService复杂类型值传递时,返回值的类型不要用接口类型。例如List应该改为ArrayList,Map改为HashMap等。

0 0