1 Reply Latest reply on Jun 17, 2012 8:12 AM by Borisa Zivkovic

    ServiceLoader and custom .jar deployments

    Veit Guna Newbie



      I'm trying to get the ServiceLoader functionality running within JBoss 7.1.0. I've got an .ear which provides the extension point (abstract class) for adding new implementations via

      JDK ServiceLoader. Now I would like to simply drop a .jar with the custom implementation into JBoss and to let the .ear pick it up. AFAIK dropping a jar into JBoss5 automatically

      published that to all deployed modules out-of-the-box. I've learned that with JBoss7, things changed.


      So I created a module that contains the custom jar (resources-root path="custom.jar") and referenced that via jboss-deployment-structure.xml within the .ear. That basically seems to work.

      But in this case, I have to know in advance, how the jar or module will be named to add the dep to the .ear. Ok, I could make the module name fixed and add every custom jar via resources-root - but

      I would like to avoid even editing the file. Simply dropping a jar to a directory should be sufficient. So I tried to use a directory in resources-root instead of a jar and put the jars into the directory.

      But in this case it seems that they won't be picked up via ServiceLoader at all.


      Is it even possible to specify a directory where all jar's are picked up by the ServiceLoader? Without mentioning them explicitly in the module.xml?