是否有可能使Map <! - ?,? - > someMethod与JAX-B一起工作?

时间:2014-02-06 16:36:22

标签: jaxb cxf

当尝试使用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 

1 个答案:

答案 0 :(得分:1)

JAXB将允许您拥有类型Map的属性,但不能将其用作根级别对象。