Reputation: 4704
I've got the following scenario:
On the one hand, I've got a tomcat instance with a lot of applications that need the activemq-all.jar which contains slf4j libraries, so I've deployed it into the lib directory, it is not optional for me to include this jar file on each app.
On the other hand I need to install a monitor application which I can't control and ships with a different version of slf4j.
Running the last application on another tomcat instance is also not an option.
I would like to configure tomcat's ClassLoader to try and load first the jars on the webapps and then the jars on the lib/ directory.
Is this possible? How can be achieved?
Upvotes: 0
Views: 4232
Reputation: 3051
By Default tomcat loads the web app classes first and gives them a higher preference than classes in its own lib directory. You can keep the mentioned jar is the lb folder. Typically i would recommend the catalina_base directory
Upvotes: 1
Reputation: 2425
Load the common jars under the Common class loader. By default, the common class loader looks for jars under:
$CATALINA_BASE/lib
$CATALINA_HOME/lib
Any jars packaged with you web app should take precedence over those found in the Common class loader.
Upvotes: 0