5
votes

I'm using tomcat 8, in

tomcat-home/config/catalina.properties

, there are sections about

common.loader, server.loader and shared.loader

However, on tomcat document about class loader(https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html), there is only has description about common.loader.

So what are differences between these 3 loader? (I know common class loader contains additional classes that are made visible to both Tomcat internal classes and to all web applications. Normally, application classes should NOT be placed here. If left blank, server.loader and shared.loader will use common.loader config. Webapp common jar can be placed in shared.loader. But what are other differences? such as differences between common.loader and server.loader, server.loader and shared.loader etc?)

1

1 Answers

8
votes

(Probably precisely because of this confusion) they're no longer used by default. The server classpath used to contain classes that were only available to the server, but not to any web application. I hope to get it right: The common loader contains classes available to every web application and the server, while the shared loader contained classes available to all web applications, but not the server.

Here be dragons - don't go there. Memory is cheap - don't use those constructs to "place some jars more optimally". The default (other than for JDBC drivers if you use JNDI resources) should be: Jars are in your web application.

They're no longer used for a reason. And the reason is understandability and maintainability of your installation. There are a lot of unexpected side effects with code that's shared between applications.