当尝试使用cxf-java2ws-plugin
生成Web服务工件时,后者又使用JAX-B,我在下面的方法中得到如下错误:
Map<?, ?> myMethod(...);
更改方法签名是最后的手段,所以我正在寻找替代方案。
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
java.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 com.company.SomeClass.arg2
at com.company.SomeClass
java.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
答案 0 :(得分:1)
JAXB将允许您拥有类型Map
的属性,但不能将其用作根级别对象。