ClassLoader.getSystemResources() looks in the system class loader, aka the classpath class loader. Bundle contents are not visible for this one, so the JDK is not going to see your classes. This happens also for implementations of RMIClassLoaderSpi, and for URLHandlers (these do not use files in META-INF/services but still use the system class loader). I think you'll have to stick to programmatically registering things for now. Going further, the OSGi standards should probably generalize what has been done for URL handlers to arbitrary things, because various places in the JDK use the system class loader. I suspect the entreprise working group is thinking about it. For RMI you even cannot register your class programmatically, so you need to provide it in an extension bundle (Fragment-Host: system.bundle; extension:="bootclasspath" or "framework" both work for RMI). - Olivier
________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Gould Sent: 07 August 2007 17:34 To: OSGi Developer Mail List Subject: [osgi-dev] Re: Bundling libs that use javax.imageio.spi More info... Looking at the code it seems that sun.misc.Service calls Classloader.getSystemResources() to find the files in META-INF/services/ If the META-INF dir or a jar containing it can be found on the Bundle-Classpath shouldn't I expect it to work? Resorted to programmatically adding the required registrations for now. MikeG On 07/08/07, Mike Gould < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hi there, I'm trying to use create a bundle for a library that uses javax.imageio.spi service registrations. The library consists of several jar files, some of which have META-INF/services/<service-class-name> files which are read by javax.imageio.spi.ServiceRegistry. When I put these jars inside an OSGi bundle jar none of these get found. I've tried copying the META-INF/services files out to the bundle jar and also (under equinox) installing my bundle unpacked but neither has helped. Is there any standard or recommended way of bundling this kind of library? thanks -- - MikeG -- - MikeG
_______________________________________________ OSGi Developer Mail List [email protected] http://www2.osgi.org/mailman/listinfo/osgi-dev
