java - Dynamically loading jars from remote location -
java - Dynamically loading jars from remote location -
is there framework or solution next scenario.
i have webapp running on tomcat server. when starting application download jars located somewhere different. external nexus server or something. in jars business logic needs injected spring.
why want this? application installed on lot of different locations. have latest version of code on installation have update 1 location , applications updated 1 time restarted.
your application need utilize custom classloader this.
the news don't have write own: can utilize java's built-in java.net.urlclassloader. bad news have wire tomcat, may require code.
this untested suggestion:
writeclassloader extends tomcat's webappclassloader add urlclassloader fellow member , initialize in constructor (or 1 of lifecyclelistener events start()) override methods phone call superclass's method of same signature , phone call same method in urlclassloader using. order in consult either super.whatever or urlclassloader.whatever you: read servlet spec determine how want things install custom classloader defining <loader> in web application's meta-inf/context.xml file. head on tomcat users' mailing list if need help of above.
edit 2014-11-04
note think using urlclassloader kind of thing fragile, error-prone, , bad idea. instead, prepare deployment process updating web application across cluster easier do. can utilize tomcat's "farm web deployer" such tasks, or utilize other solution. loading classes on network complicate life , result in unusual non-reproducible behavior in cases.
java tomcat nexus
Comments
Post a Comment