You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Miller <dm...@smart911.com> on 2000/12/18 21:19:40 UTC
CLASSPATH precedence
Hi,
Two related questions regarding CLASSPATH precedence:
(A) If I place the same *.jar files (same names but different versions)
in both
$TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/lib
and in $TOMCAT_HOME/webapps/WEBAPP_B/WEB-INF/lib
does the version of the *.jar files in WEBAPP_A or in WEBAPP_B take
precedence? Or does it depend on which context I am in (i.e., which
webapp tomcat is running). How does tomcat figure out which version of
the *.jar files to use? Do classes loaded from one *.jar file get
unloaded if I am running in a different context?
(B) (similar question but for system *.jar files vs tomcat *.jar files):
If I place the same *.jar files (same names but different versions) in
both
$TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/lib
and in my system CLASSPATH
which version of the *.jar files take precedence when I am running ?
Any answers/information regarding these two questions is greatly
appreciated, especially ones which shed some light on how tomcat figures
out which version of classes to load. Thanks,
-David-
Re: CLASSPATH precedence
Posted by ??? <pe...@nextenso.com>.
David,
For tomcat 3.2 (tomcat 4.0 is different), the classes from $TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/lib and $TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/classes sont loaded by a custome classloader. The classes from system CLASSPATH sont loaded by the system classloader. The class loading is in the following order: 1) BootStrap; 2)Extension; 3) System Classpath; 4) special directories known by the custom classloader, so
1) the classes in $TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/lib
and in $TOMCAT_HOME/webapps/WEBAPP_B/WEB-INF/lib sont completly different.
2) The classes in the system CLASSPATH take precedence.
Regards
-Peiqiang
----- Original Message -----
From: "David Miller" <dm...@smart911.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, December 19, 2000 4:19 AM
Subject: CLASSPATH precedence
> Hi,
>
> Two related questions regarding CLASSPATH precedence:
>
> (A) If I place the same *.jar files (same names but different versions)
> in both
> $TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/lib
> and in $TOMCAT_HOME/webapps/WEBAPP_B/WEB-INF/lib
>
> does the version of the *.jar files in WEBAPP_A or in WEBAPP_B take
> precedence? Or does it depend on which context I am in (i.e., which
> webapp tomcat is running). How does tomcat figure out which version of
> the *.jar files to use? Do classes loaded from one *.jar file get
> unloaded if I am running in a different context?
>
> (B) (similar question but for system *.jar files vs tomcat *.jar files):
>
> If I place the same *.jar files (same names but different versions) in
> both
> $TOMCAT_HOME/webapps/WEBAPP_A/WEB-INF/lib
> and in my system CLASSPATH
>
> which version of the *.jar files take precedence when I am running ?
>
> Any answers/information regarding these two questions is greatly
> appreciated, especially ones which shed some light on how tomcat figures
> out which version of classes to load. Thanks,
>
> -David-
>
>