You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Julien Charon <Ju...@avitech.aero> on 2015/06/17 08:40:29 UTC

JAX-WS: customize JAXB context

  Hi,


I currently run into a JAXB related error when I start tomcat and my webservice is started:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
javax.xml.bind.JAXBElement does not have a no-arg default constructor.

I analysed that and got to the conclusion that the reason for the error is that the JAXB context is initialised with the javax.xml.bind.JAXBContext.newInstance(Class...) factory method. I am actually able to reproduce the error in a JUnit test when I try to create a JAXB context with that factory method providing the class causing the error.
On the other side, I already use those JAXB classes in another application, but there I use the javax.xml.bind.JAXBContext.newInstance(String) factory method and provide the relevant packages. That works without problems.
Now my question is: is there a way to configure the JAXB context so that is initialised by providing the package names?

I also tried to run tomcat with a JAXB 2.2 impl using the endorsed mechanism. In that case the webservice starts without problems. But then I have the situation that the JAXB objects used in the service methods are not correctly initialised: they are all JAXBElements with no value, i.e. javax.xml.bind.JAXBElement.getValue() always returns null and I cannot access the relevant data.



Mit freundlichen Grüßen / With kind regards,
Julien Charon

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.charon@avitech.aero<ma...@avitech.aero>
________________________________________________
Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero<http://avitech.aero/>

This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.