Hi,
I am trying to use the java.util.ServiceLoader inside an ear, i.e. I have an application like this:
My.ear:
+-lib
+- A.jar
+-B.jar
+- META-INF/services/com.xyz.MyInterface
Now a class that is in A.jar tries to get an implementation using
ServiceLoader.load(MyInterface.class) and alternatively ServiceLoader.load(MyInterface.class, Thread.currentThread().getContectClassLoader()).
But unfortunately both calls fail and return an empty iterator.
In a test without a server it works fine, but as soon as I start this stuff on JBoss it fails.
Has anyone already managed to get something like this running?
I could imagine, that the jboss-modules refuses loading the services resources, but it should be possible to access it specifying some dependencies like for instance when you want to get th service of a module where you set Dependencies: MyModule service
Does anyone have a good tip?
Thanks & kind regards,
Robert
My fault.
I did not realize, that in my real code, the starting point was a resource adapter initialization.
That one did not use the TCCL. When I use it, everything is fine.