Hi Bertrand, I see! Thank you for pointing to the workaround: that’s exactly what I’m doing now as I’m unable to change the base class which resides in a library.
Cheers Dominique On Wed, May 28, 2014 at 11:44 AM, Bertrand Delacretaz < [email protected]> wrote: > Hi Dominique, > > On Wed, May 28, 2014 at 11:25 AM, Dominique Pfister <[email protected]> > wrote: > > ...I’m creating a Sling Servlet that is derived from an abstract base > class: > > in the base class’s init() method, some factory class is loaded via > > Thread.getCurrentThread().getContextClassLoader(). I was surprised that > the > > loader returned is the standard AppLoader, while I would have expected > the > > bundle’s class loader... > > In general you shouldn't use the thread context class loader (TCCL) in > OSGi components. C.getClassLoader() returns the bundle class loader of > class C that's provided by a bundle. > > If you're stuck with existing code that does use the TCCL, you'll need > to set it yourself as done for example in [1] > > -Bertrand > > [1] > https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/util/RepositoryAccessor.java >
