karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-5674) Karaf 4.2.0 M2 class load issue
Date Tue, 27 Mar 2018 18:13:00 GMT

    [ https://issues.apache.org/jira/browse/KARAF-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16416030#comment-16416030

Guillaume Nodet commented on KARAF-5674:

Could you try again with a 4.2.0-SNAPSHOT ? I've just fixed KARAF-5680 which should help.

> 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

View raw message