Is it possible to make Map <?,?> SomeMethod work with JAX-B?

When I try to create web service artifacts with the help of cxf-java2ws-pluginwhich, in turn, uses JAX-B, I get the error below using a method that looks like this:

  Map<?, ?> myMethod(...);

Changing the method signature is a last resort, so I'm looking for alternatives.

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 
+3
source share
1 answer

JAXB allows you to have a type property Map, but not use it as a root level object.

+1
source

All Articles