I'm using wadl2java to generate api and model classes from a WADL (CXF 3.1.6).

I'm using the JacksonProvider in the client call:

JacksonJsonProvider provider = new JacksonJsonProvider();
List<Object> providers = new ArrayList<Object>();
providers.add(provider);
api = JAXRSClientFactory.create(serverApp, MyApiResource.class, providers);

However, the generated ObjectFactory.java seems to overrule the Json provider and throws the following exception:

WARNING: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.internal.SAXException2: unable to marshal type "at.myapp.MyCustomType" as an element because it is missing an @XmlRootElement annotation]

If I remove the ObjectFactory.java from the buildpath (<exclude>**/at/myapp/ObjectFactory.java</exclude> in pom.xml), then everything is working like a charm (Json gets assembled/parsed correctly).

This problem doesn't exist if I use CXF 2, there everything is working out of the box.

Is there another way to get the CXF 3 client working with wadl2java without removing ObjectFactory.java from the buildpath?

Best regards,
J. Fiala

Reply via email to