I'm using MOXy in an OSGI environment (E4 RCP) and a bit confused about a classloader problem in conjunction with MOXy's "XML bindings document" capabilities.
Constraint:
The be marshalled objects are separated in different osgi bundles.
Case 1:
Standard JAXB annotations in the domain classes. Creating the JAXBContext works fine, independent of the different osgi-bundles. It works with standard JAXB as well as with MOXy.
Case 2:
The mapping informations are provided by "xml bindings documents". For each package one document. Creating the JAXBContext of the domain classes now fails with the following exception:
Exception [EclipseLink-50025] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Could not load class [xx.xx.YY] declared in the external metadata file. Please ensure that the class name is correct, and that the correct ClassLoader has been set.
at org.eclipse.persistence.exceptions.JAXBException.couldNotLoadClassFromMetadata(JAXBException.java:390)
at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.getXmlBindingsClasses(JAXBContext.java:1140)
at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1029)
at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:182)
Case 3:
The mapping informations are again provided by "xml bindings documents". Creating the JAXBContext only of domain classes, which are in the same osgi-bundles, works.
It's seems clearly to be a classloader problem due to the osgi-environment. Did I miss a point or is it just a bug in MOXy?
No comments:
Post a Comment