Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 6 vs 7 - lib vs shared/lib - jars only?

When upgrading from Tomcat 6 to Tomcat 7 - we kept a number of files we wanted on the classpath in the $CATALINA_HOME/lib directory on 6 - and it made sense to move these two $CATALINA_HOME/shared/lib on Tomcat 7.

What we've found is that the jar files went across ok - but anything that wasn't a jar file - eg an xml file etc was not picked up by the class loaded in the shared/lib directory. When we moved the non-jar files back to the $CATALINA_HOME/lib directory - they loaded into the classpath without an issue.

My question is - is this a bug in the classloader in Tomcat 7? Or is this intended behaviour? (Failing to load non-jar files onto the classpath from the $CATALINA_HOME/shared/lib in a manner inconsistent to that which loads files from $CATALINA_HOME/lib)

OS: Windows7

Tomcat version: 7.0.30

Java version: 1.7.0_11

like image 576
hawkeye Avatar asked Jun 27 '13 03:06

hawkeye


People also ask

Is Tomcat 7 still supported?

The Apache Tomcat team announces that support for Apache Tomcat 7.0. x will end on 31 March 2021.

Which folder is used to store the runtime jars for Tomcat?

Tomcat JAR deployment options Package the JAR file in the WEB-INF\lib folder of the Java web application; Place the JAR file in the \lib subfolder of the Apache Tomcat installation; Configure a folder for shared JAR files by editing Tomcat's common.

What is classpath in Tomcat server?

A classpath is an argument that tells the JVM where to find the classes and packages necessary to run a program. The classpath is always set from a source outside the program itself.


1 Answers

I don't use shared lib, but according to this doc: http://wiki.apache.org/tomcat/HowTo

Note that Tomcat 6.0.14 the $CATALINA_HOME/shared/lib directory does not exist.

You will need to add this and you will need to edit $CATALINA_HOME/conf/catalina.properties so that the shared.loader line looks like this shared.loader=$CATALINA_HOME/shared/lib

like image 131
Darius X. Avatar answered Oct 15 '22 02:10

Darius X.