camel-karaf icon indicating copy to clipboard operation
camel-karaf copied to clipboard

camel-xml-jaxb is missing 'org.apache.camel.model.app' Import

Open lichtin opened this issue 6 months ago • 3 comments

Caused by: jakarta.xml.bind.JAXBException: "org.apache.camel.model.app" doesnt contain ObjectFactory.class or jaxb.index at org.glassfish.jaxb.runtime.v2.ContextFactory.createContext(ContextFactory.java:241) ~[!/:4.0.5 - cb19596] at org.glassfish.jaxb.runtime.v2.JAXBContextFactory.createContext(JAXBContextFactory.java:58) ~[!/:4.0.5 - cb19596] at jakarta.xml.bind.ContextFinder.find(ContextFinder.java:322) ~[!/:4.0.2] at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:392) ~[!/:4.0.2] at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:349) ~[!/:4.0.2] at org.apache.camel.xml.jaxb.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:44) ~[!/:?] at org.apache.camel.xml.jaxb.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:32) ~[!/:?] at org.apache.camel.xml.jaxb.JaxbHelper.getJAXBContext(JaxbHelper.java:78) ~[!/:?] at org.apache.camel.xml.jaxb.JaxbHelper.loadRoutesDefinition(JaxbHelper.java:389) ~[!/:?]

Class DefaultModelJAXBContextFactory is providing its class loader which does not "see" the org.apache.camel.model.app package.

lichtin avatar Aug 12 '25 10:08 lichtin

@lichtin can you describe quickly a way to reproduce the JAXBException ? Is it while loading a blueprint route ?

jbonofre avatar Oct 20 '25 16:10 jbonofre

It's done programmatically via a method call, given a Camel context, such as

JaxbHelper.loadRoutesDefinition(modelCamelContext, is);

lichtin avatar Oct 21 '25 11:10 lichtin

Patched the Manifest file and had to add the following to the "Import-Package" directive:

org.glassfish.jaxb.runtime.v2, org.apache.camel.model.app, org.apache.camel.model.cloud, org.apache.camel.model.config, org.apache.camel.model.errorhandler, org.apache.camel.model.loadbalancer, org.apache.camel.model.transformer, org.apache.camel.model.validator

to get above mentioned loadRoutesDefinition working.

lichtin avatar Nov 01 '25 09:11 lichtin