How to load the jar files present in different location from tomcat using custom class loader
I would like to load the jar (developed in spring) files from my war in tomcat 7.0.5. Could you please help me out?. Detailed explanation is below.
Step 1 : A war (developed using spring) with few jars is put into the webapps folder of tomcat Step 2 : Keep few jars (developed using spring) in different location (not inside webapps) , say /xxx/libs Step 3 : My war should be able to load the jars from /xxx/libs and refresh the context.
Note : the jars present under /xxx/libs/ will have dependency with the jars present in the war
Please help me out.
What type of class loader should i use? Where to place the Class loader?
It worked By giving the location of the jars in virtual classpath to VirtualWebappLoader.
<Context antiJARLocking="true" path="/websandbox"> <Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="/xxx/libs/"/> </Context>