See comments intermixed...
> -----Original Message-----
> From: Brett G. Palmer [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 14, 2001 11:08 AM
> To: [EMAIL PROTECTED]
> Subject: Order of libraries in CLASSPATH question?
>
>
> We are having random problems with some of our application
> libraries when we
> deploy them in their separate contexts. The question I have
> is what is the
> default behavior for Tomcat to load class libraries into its
> CLASSPATH. Do
> libraries from the $TOMCAT_HOME/lib directory get added to
> the CLASSPATH
> before libraries for a particular web application (e.g.
> webapps/someapp/WEB-INF/lib/*) or viceversa.
If you look in your %TOMCAT_HOME%/logs/jasper.log file, it will show you the
classpath it is using for each request. In general the effective classpath
for a webapp will be:
WEB-INF/classes/
WEB-INF/lib/*.jar (in aplpabetical order I believe)
%TOMCAT_HOME%/classes (only if using Unix's tomcat.sh)
%TOMCAT_HOME%/lib/*.jar (in alphabetical order, only if using Windows's
tomcat.bat)
%TOMCAT_HOME%/lib/* (in alphabetical order, only if using Unix's tomcat.sh)
System Classpath (in orginial order)
Remember that the classpath is searched from first to last.
>
> I have also seen problems where my web application can't find
> a particular
> library when it is added to the "webapps/someapp/WEB-INF/lib"
> but it can
> find it when it is added to the $TOMCAT_HOME/lib directory.
> This particular
> problem occurred when I tried to use Oracle's jdbc drivers (i.e.
> classes12.zip). I would get class not found errors when the
> classes12.zip
> file was located in the WEB-INF/lib directory, but the errors
> went away when
> I used the $TOMCAT_HOME/lib directory.
The automatic loading for the WEB-INF/lib directory only includes .jar files
- its implied from the Spec that other behavior is non-compliant. The
tomcat/lib directory depends on your startup script
>
> What is the recommended place for putting class libraries in
> the classpath
> for Tomcat? Any suggestions would be greatly appreciated.
You shouldn't edit your classpath for Tomcat - you should put your classes
into the WEB-INF{/lib/*.jar|/classes/} (preferred) or %TOMCAT_HOME%/lib.
Many people will argue that if the classes are common across webapps then
you should use the second one, but I would caution against this as it makes
it hard to upgrade one webapp at a time to new versions of libraries.
>
> Thanks in advance,
>
>
> Brett
>
Randy