Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-5674

Karaf 4.2.0 M2 class load issue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 4.2.0.M2
    • None
    • karaf
    • None

    Description

      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:

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bobanbp Boban Petkovic
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: