Categories
AI & Tech

How to add a JAR as a shared resource for more than one application on Tomcat?

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).

Steps:
  • Create the following folders in your CATALINA_HOME directory
    • shared
      • classes
      • lib
  • 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:

How to collect thread dump from Tomcat using Jstack utility tool

5 Best programming language to learn in 2018

If you thing any information is missing, please do comment below so that the rest of the viewers can benefit out of it.

 

Summary
Article Name
How to add a JAR as a shared resource for more than one application on Tomcat
Description
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.
Author
Publisher Name
www.aneetin.com
Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version