You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Boban Petkovic (JIRA)" <ji...@apache.org> on 2018/03/20 17:42:00 UTC

[jira] [Updated] (KARAF-5674) Karaf 4.2.0 M2 class load issue

     [ https://issues.apache.org/jira/browse/KARAF-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boban Petkovic updated KARAF-5674:
----------------------------------
    Summary: Karaf 4.2.0 M2 class load issue  (was: Karaf 4.2.0 M2 class path issue)

> Karaf 4.2.0 M2 class load 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
>            Priority: Critical
>
> 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 to set class loader to use our bundle's context it worked fine:
> {code:java}
> ClassLoader tccl = Thread.currentThread() .getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
> AWS SDK calls that fails (from bundle B) 
> Thread.currentThread().setContextClassLoader(tccl);{code}
> 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)