maven - How to make Java serviceLoader of a external library work -
maven - How to make Java serviceLoader of a external library work -
i'm working on plugin 3rd party software quite undocumented. plugin i'm using external lib (.jar) managed maven , later on executed on tomcat server. working great till updated latest release of library, using java.util.serviceloader in order load concrete implementation of interface. when build, project has bundle construction on tomcat server:
mypluginpackage.jar | ---meta-inf ---lib | --- theexternallibusingserviceloader.jar | ---meta-inf | ---services | --- full.path.to.thefactoryinterface ---external.lib.path | --- thefactoryinterface.class --- theconreteclass.class --- myplugincore.jar | ---meta-inf --- my.plugin.path | --- myclassusingtheexternallib.class
as can see, external library has right services entry necessary serviceloader find concrete of interface within meta-inf. content of full.path.to.thefactoryinterface
file full.path.to.theconcreteclass
, seems legit.
my plugin (package core) not have of meta-inf information.
what happens every time plugin using method trigger serviceloader of external library, serviceloader unable find concrete implementation.
what tried adding exact same services/full.path.to.thefactoryinterface
meta-inf directories, not working (i guess need alter content of full.path.to.thefactoryinterface file i'm not sure - because of undocumented plugin construction 3rd party software - right (relative) path like).
can give me shot i'm doing wrong here , how prepare concrete class found serviceloader? meta-inf folder should services folder it's content placed in , should alter paths? error @ or missing compleatly different?
i understand special topic since 3rd party software unkown, info depending serviceloader , it's behaviour when run across multiple jars multiple meta-inf folders , in different execution context / classpaths appreciated.
i able working extending external lib i'm able provide custom classloader. turned out, default classloader wrong.
also able in touch 3rd party tool devs , info needed - phone call "social decompiling".
everything working now.
java maven dependency-injection serviceloader
Comments
Post a Comment