Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6751905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:58:58+00:00 2026-05-26T12:58:58+00:00

The Tomcat Class Loader HOW-TO documentation describes 4 different class loaders: Bootstrap System Common

  • 0

The Tomcat Class Loader HOW-TO documentation describes 4 different class loaders:

  1. Bootstrap
  2. System
  3. Common
  4. Webapp

In the default catalina.properties file, however, there are properties defined for a shared and server class loader as well. In the default version of the file both of these properties are empty and the comments say:

If left as blank, the “common” loader
will be used as Catalina’s
“shared”/”server” loader.

I have not been able to find any additional documentation about these class loaders. My question is, in which order are the shared and system loaders searched relative to the common loader? And additionally, what is the intended use for these class loaders?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:58:58+00:00Added an answer on May 26, 2026 at 12:58 pm

    I recently ran into this issue as well and here is what I found, (This is all from Tomcat 7 trunk)

    If left as blank, the “common” loader will be used as Catalina’s “shared”/”server” loader.

    Here is the relevant source,

    89      private void initClassLoaders() {
    90          try {
    91              commonLoader = createClassLoader("common", null);
    92              if( commonLoader == null ) {
    93                  // no config file, default to this loader - we might be in a 'single' env.
    94                  commonLoader=this.getClass().getClassLoader();
    95              }
    96              catalinaLoader = createClassLoader("server", commonLoader);
    97              sharedLoader = createClassLoader("shared", commonLoader);
    98          } catch (Throwable t) {
    99              handleThrowable(t);
    100             log.error("Class loader creation threw exception", t);
    101             System.exit(1);
    102         }
    103     }
    
    106     private ClassLoader createClassLoader(String name, ClassLoader parent)
    107         throws Exception {
    108 
    109         String value = CatalinaProperties.getProperty(name + ".loader");
    110         if ((value == null) || (value.equals("")))
    111             return parent;
    

    So if nothing is defined, they fallback to using the common.loader entries.


    As to the order that they are loaded in,
    here is the source for loading them in, from source

    229         Thread.currentThread().setContextClassLoader(catalinaLoader);
    230 
    231         SecurityClassLoad.securityClassLoad(catalinaLoader);
    232 
    233         // Load our startup class and call its process() method
    234         if (log.isDebugEnabled())
    235             log.debug("Loading startup class");
    236         Class<?> startupClass =
    237             catalinaLoader.loadClass
    238             ("org.apache.catalina.startup.Catalina");
    239         Object startupInstance = startupClass.newInstance();
    240 
    241         // Set the shared extensions class loader
    242         if (log.isDebugEnabled())
    243             log.debug("Setting startup class properties");
    244         String methodName = "setParentClassLoader";
    245         Class<?> paramTypes[] = new Class[1];
    246         paramTypes[0] = Class.forName("java.lang.ClassLoader");
    247         Object paramValues[] = new Object[1];
    248         paramValues[0] = sharedLoader;
    249         Method method =
    250             startupInstance.getClass().getMethod(methodName, paramTypes);
    251         method.invoke(startupInstance, paramValues);
    

    Line 229 sets the common.loader classLoader, then line 251 sets the shared.loader classloader is set as Catalinas parent class loader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On a Tomcat 5.5 server, I put a class in the system classpath (and
I have gotten everything working for my class in which I am using Tomcat
Tomcat documentation says: The locations for Context Descriptors are; $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml $CATALINA_HOME/webapps/[webappname]/META-INF/context.xml On my server,
Does someone found a way to use (for development) a dynamic class loader for
If I have classes that need to be shared between my webapp and Tomcat
Is there anyone who has succeeded in making a self-contained .war file using Tomcat
I'm trying to practice myself with custom class loaders, and I've some questions. Is
I have problems with class loaders. Sometimes it works, sometimes it doesn't work. When
java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/web/tomcat/tc5/WebAppClassLoader) previously initiated loading for a different
When I try to run my webapp on Tomcat 7, I got the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.