One-Jar and service loader

Help
2013-09-30
2014-05-19
  • Hello,

    I'm experiencing a problem while packaging a Java application with One-Jar in which a dependency JAR uses the Java ServiceLoader mechanism to provide its service.

    In short, when this JAR it is embedded in the One-Jar packaged app the the service it is not loaded (apparently the class-loader it is unable to access the META-INF/services/descriptor file in the embedded JAR).

    Is there any way or workaround to handle this?

    Best and thanks for your tool.
    Paolo

     
  • Tom Eugelink
    Tom Eugelink
    2013-12-07

    Same problem here.

     
  • Gus Heck
    Gus Heck
    2014-05-19

    Seems this is likely to be related to my recently reported issue: https://sourceforge.net/p/one-jar/bugs/75/

    You might try promoting the services descriptor to the top level of the onejar as a workaround. That worked for my use case (though I'm not using ServiceLoader so YMMV)