This article will help you understand
How to add a JAR as a shared resource for more than one application on Tomcat
There is a huge change in the architecture of Tomcat itself during the evolution of Tomcat 6.0 / 7.0 releases after the Tomcat 5.5 and hence a change in the folder structure as well. This change has more to do with the default configuration of the class loaders from Tomcat 5.5 to Tomcat 6.0/7.0.
The Tomcat 5.5 instance used to have folders named “shared”, “common” and “server” which are now condensed to just one folder called “lib” starting from Tomcat 6.0. The main purpose of these 3 folders was to hold jars and class files that were made available to the “shared”, “common” and the “server” class loaders. Since the aforementioned folders are all condensed to a single folder, “lib” folder dictates the jars / class files available for all the 3 class loaders (namely shared, common and server).
Depending on the situations that we work on, it is an advantage to have a separate “shared” folder under %CATALINA_HOME% (as previously was available in Tomcat 5.5. If not download Tomcat 5.5).
- Create the following folders in your CATALINA_HOME directory
- Modify the conf/catalina.properties to dictate Tomcat 6.0/7.0 to use the shared directories instead of the lib directory which is by default. Take a backup of your configuration file, as ALWAYS!
- Locate shared.loader= property and change it to shared.loader=”shared/classes,shared/lib/*.jar”
- Save conf/catalina.properties and then start the Tomcat server.
With these steps, the shared class-loader should be configured to load classes from the shared folder.
I hope the article has helped you.
Read more on:
If you thing any information is missing, please do comment below so that the rest of the viewers can benefit out of it.