Hello,
When running Karaf 4.2.4 with Java 11 I'm getting the following error when
restarting/reloading bundle from web console:
Caused by: java.lang.ClassNotFoundException:
com.sun.xml.internal.bind.v2.ContextFactory not found by
org.apache.karaf.webconsole.console [73]
The bundle starts normally, (it imports javax.xml.bind and org.xml.sax, I
have CXF feature installed).
>From my understanding, the problem is caused, because when I restart bundle
from web console, the blueprint activator runs not with its bundle
classloader, but from WebConsole classloader, and javax.xml.bindJAXBContext
does 'tricks' with Classloader...
Is my guessing right? Is it something that I need to fix in my code that
calls JAXB, or it's the problem with Karaf configuration (installed features
etc.)?
This is the stack trace I get, I've replaced only 2 own class names..
Caused by: java.lang.ClassNotFoundException:
com.sun.xml.internal.bind.v2.ContextFactory not found by
org.apache.karaf.webconsole.console [73]
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
~[?:?]
at
org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
~[?:?]
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1927)
~[?:?]
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
~[?:?]
at
org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLoader.java:176)
~[112:org.ops4j.pax.web.pax-web-jetty:7.2.8]
at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
at
org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLoader.java:192)
~[112:org.ops4j.pax.web.pax-web-jetty:7.2.8]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at
javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:92)
~[?:?]
at
javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:125)
~[?:?]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:230)
~[?:?]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:375) ~[?:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:691) ~[?:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:632) ~[?:?]
at mypackage.MyJaxbService.unmarshall(ConfigMarshallerImpl.java:45)
~[?:?]
at Proxy122c1639_29a1_458c_b3e0_adf1d71be792.unmarshall(Unknown Source)
~[?:?]
at
myanotherpackage.MyBundleService.init(DataExportConfigPublisher.java:52)
~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[?:?]
at
jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[?:?]
at
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:337)
~[?:?]
at
org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:835)
~[?:?]
at
org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:591)
~[?:?]
... 71 more
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html