1

I'm using MOXy under fuse ESB (based on karaf). When trying to create new instance of JAXBContext i get error : property "eclipselink-oxm-xml" is not supported.

I have placed jaxb.properties file with content : javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory in same package as domain classes. And xml-bindings file is loaded succesfully.

Map<String, Object> properties = new Hashmap<>(1);
properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, Utils.class.getResource("xml-bindings.xml").getPath());
JAXBContext jc = JAXBContext.newInstance(clazz, properties); 

The main problem is that, when i run the function which uses this xml-bindings.xml properties from eclipse with JUnit tests, everything works fine, but when i run it in OSGi environment and call this function, i receive error : property "eclipselink-oxm-xml" is not supported.

So maybe somebody could give me the clue, what is wrong, why it fails to create new jaxbcontext in OSGi?

EDIT: System.getProperty("javax.xml.bind.context.factory") returns org.eclipse.persistance.jaxb.JAXBContextFactory, so i guess jaxb properties file is loaded.

  • as we figured out problem is osgi cointainer has couple bundles exporting diffrent javax.xml.binding packages which javax.xml.binding osgi bundle version is needed to run moxy 2.4 . We guess javax.xml.binding version we get from osgi is too old to understand eclipselink-oxm-xml property. – user3631404 May 15 '14 at 09:14

0 Answers0