Boban Petkovic created KARAF-5674:
-------------------------------------
Summary: Karaf 4.2.0 M2 class path issue
Key: KARAF-5674
URL: https://issues.apache.org/jira/browse/KARAF-5674
Project: Karaf
Issue Type: Bug
Components: karaf-osgi
Affects Versions: 4.2.0.M2
Reporter: Boban Petkovic
While migrating our application to work on karaf 4.2.0 (once it got released) I
hit an issue with class loader while testing on karaf 4.2.0 M2. I will try to
explain it simple:
Let say I have bundle A that contains REST endpoints (CXF 3.2.2). I use dosgi
to register CXF endpoints. From REST endpoint (in bundle A) we invoke some code
from bundle B that uses aws-java-sdk-osgi bundle (version 1.11.272). This fails
with the error:
javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory
not found
The same code works on karaf 4.1.5 and karaf 4.0.7 that we use at the moment.
After some investigation I figured out that the context of class loader used to
invoke the code from our bundles is org.apache.cxf.cxf-rt-transports-http. When
I tried something like this it works fine:
ClassLoader tccl = Thread.currentThread() .getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
AWS SDK calls that fails (from bundle B)
Thread.currentThread().setContextClassLoader(tccl);
Has something been changed when it comes to class loading mechanism in 4.2.0?
While testing the same code on 4.1.5 I can see that the same context
(org.apache.cxf.cxf-rt-transports-http) is used, but it works fine.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)