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"

Need Your Help

Can I store int in longtext column and sum it?

php mysql wordpress

When save a post, I saved a "point" value in post_content_filtered column in wp_posts table. I didn't save it in postmeta table because it's not easy to make sum in postmeta. Also, wordpress never...

How do I make a webpage output XML using jQuery or PHP?

php javascript jquery xml

I am trying to make an XML generator and then use Java to read into the XML schema to create a survey. How would I make a webform or something else output XML? Here is an example of part of the XML...