this code causes ClassNotFoundException (org.glassfish.jaxb.runtime.v2.ContextFactory not found) for routes deployed on karaf environment (works well in standalone routes):
import jakarta.xml.bind.JAXBContext;
...
JAXBContext ctx = JAXBContext.newInstance(ArrayList.class);
because camel-karaf has 2 incompatible features jaxb-runtime, and loads only 3.0.2 jaxb bundles:
<feature name="jaxb-runtime" version="3.0.2">
<feature version="[3,4)">jakarta-xml-bind</feature>
<bundle dependency="true">mvn:com.sun.xml.bind/jaxb-core/3.0.2</bundle>
<bundle dependency="true">mvn:com.sun.xml.bind/jaxb-impl/3.0.2</bundle>
<bundle dependency="true">mvn:com.sun.xml.bind/jaxb-osgi/3.0.2</bundle>
</feature>
<feature name="jaxb-runtime" version="4.0.5">
<feature version="[4,5)">jakarta-xml-bind</feature>
<bundle dependency="true">mvn:com.sun.istack/istack-commons-runtime/4.1.2</bundle>
<bundle dependency="true">mvn:org.glassfish.jaxb/jaxb-core/4.0.5</bundle>
<bundle dependency="true">mvn:org.glassfish.jaxb/jaxb-runtime/4.0.5</bundle>
<bundle>mvn:org.glassfish.hk2/osgi-resource-locator/2.5.0-b42</bundle>
</feature>
karaf@root()> feature:list|grep jaxb-runtime
jaxb-runtime | 3.0.2 | | Uninstalled | camel-4.8.2 |
jaxb-runtime | 4.0.5 | | Started | camel-4.8.2 |
and loads only packages v 3.0.2:
karaf@root()> list|grep JAXB
113 | Active | 50 | 4.8.2 | Apache Camel :: Karaf :: Core :: XML JAXB
131 | Active | 80 | 3.0.2 | JAXB OSGI
karaf@root()> package:exports -p org.glassfish.jaxb.runtime.v2
Package Name | Version | ID | Bundle Name
---------------------------------------------------+---------+-----+---------------------------
org.glassfish.jaxb.runtime.v2.model.annotation | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.model.impl | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.model.runtime | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.runtime.output | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.runtime.property | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.runtime.reflect.opt | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.runtime.reflect | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.runtime | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.schemagen.xmlschema | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.schemagen | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2.util | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
org.glassfish.jaxb.runtime.v2 | 3.0.2 | 131 | com.sun.xml.bind.jaxb-osgi
I have tried to change 4.0.5 bundle dependency value to "false", but it does not work because camel-blueprint requires jaxb bundles version 3.
this code causes ClassNotFoundException (org.glassfish.jaxb.runtime.v2.ContextFactory not found) for routes deployed on karaf environment (works well in standalone routes):
because camel-karaf has 2 incompatible features jaxb-runtime, and loads only 3.0.2 jaxb bundles:
and loads only packages v 3.0.2:
I have tried to change 4.0.5 bundle dependency value to "false", but it does not work because camel-blueprint requires jaxb bundles version 3.