Hi

From an OSGi bundle I need to call a library that itself uses ServiceLoader to 
lookup/load a service provider class.

This does not seem to work, however. java.util.ServiceLoader.load(x.api.z) 
returns no providers.

I embedded the library, so both file META-INF/services/x.api.z and class 
x.spi.z are part of my bundle JAR.
I thought this would be enough to get ServiceLoader to work, but no :-(

Any ideas? 


I already tried

         ClassLoader thread = Thread.currentThread().getContextClassLoader();
         
Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); 
         <call-library>
         Thread.currentThread().setContextClassLoader(thread);


in case TCCL would be the problem, but that didn't help.

Martin

Reply via email to