-
1. Re: AS6 support for Service.providers()
jaikiran Oct 26, 2011 12:06 AM (in response to bwallis42)1 of 1 people found this helpfulI don't see a reason why it shouldn't work. However, I haven't looked at how the ImageIO method is implemented. So it might have to do with the implementation. Do you have more details about that?
Edit: I misread your post. I thought ImageIO was some class from the library that you are using.
-
2. Re: AS6 support for Service.providers()
jaikiran Oct 26, 2011 12:12 AM (in response to jaikiran)1 of 1 people found this helpful/** * Scans for plug-ins on the application class path, * loads their service provider classes, and registers a service * provider instance for each one found with the * <code>IIORegistry</code>. * * <p>This method is needed because the application class path can * theoretically change, or additional plug-ins may become available. * Rather than re-scanning the classpath on every invocation of the * API, the class path is scanned automatically only on the first * invocation. Clients can call this method to prompt a re-scan. * Thus this method need only be invoked by sophisticated applications * which dynamically make new plug-ins available at runtime. * * <p> The <code>getResources</code> method of the context * <code>ClassLoader</code> is used locate JAR files containing * files named * <code>META-INF/services/javax.imageio.spi.</code><i>classname</i>, * where <i>classname</i> is one of <code>ImageReaderSpi</code>, * <code>ImageWriterSpi</code>, <code>ImageTranscoderSpi</code>, * <code>ImageInputStreamSpi</code>, or * <code>ImageOutputStreamSpi</code>, along the application class * path. * * <p> The contents of the located files indicate the names of * actual implementation classes which implement the * aforementioned service provider interfaces; the default class * loader is then used to load each of these classes and to * instantiate an instance of each class, which is then placed * into the registry for later retrieval. * * <p> The exact set of locations searched depends on the * implementation of the Java runtime enviroment. * * @see ClassLoader#getResources */ public static void scanForPlugins() { theRegistry.registerApplicationClasspathSpis(); }
So I'm guessing that it's a case of wrong (thread context) classloader being used whenver that call to scanForPlugins is happening. It probably isn't using the deployment's classloader and instead using the server level classloader which doesn't have visibility to the deployments classes/resources.
-
3. Re: AS6 support for Service.providers()
bwallis42 Oct 26, 2011 11:19 PM (in response to jaikiran)Thanks for the comments on this. Since we have a work around I won't persue this in the AS6 version. Since AS7 is completly different in how all of this works and from what I understand about the support of services in modules, I expect this won't be so much of a problem - we will see...
We are using a different version of the ImageIO stuff from what is included in the JDK so that is probably contributing to the problem. Having any duplicate classes of differing versions is always going to cause odd and difficult problems in JBoss, at least for 6 and earlier.
thanks again.