ClassNotFoundException when trying to unmarshal class from JSON via JAXB (EclipseLink Moxy)
I have a library with a package of classes with JAXB annotations.
The package contains a jaxb.properties file with the following content: "javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory".
The library has a compile time dependency (Maven) on EclipseLink.
I use EclipseLink Moxy to unmarshal JSON strings to Java objects.
This library is used by an application with a JAX-WS interface packaged in a war file. (The war contains the EclipseLink jar in its WEB-INF/lib folder.)
For testing purposes the war also contains a servlet which allows to use the functionality via browser.
I have used Tomee 1.7.4 and 1.7.5 both with the same behavior:
When I access the functionality via browser/servlet everything is working fine.
When I send a request with a JAX-WS client, I get the following error:
javax.xml.bind.JAXBException: Provider org.eclipse.persistence.jaxb.JAXBContextFactory not found
This email may contain confidential or proprietary information and company or business secrets, may be legally privileged, and is for the intended recipient only. Taking knowledge, disclosure, copying, distribution and reliance or any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. Many thanks.