My test was not as complete are thorough as yours, but I can say that under
Tomcat 3.2.2 running on Win2000, this is not the result I am seeing. I'm
finding that public variables in common.jar across multiple webapps are
shared.
Can you upload your two WAR files so that I can perform the same test
without writing the same code / logic from scratch?
thanks,
jeff
----- Original Message -----
From: "Bo Xu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 13, 2001 11:10 AM
Subject: Re: static,synchronized and classloaders
> Hi :-) I did a test with TC4.0-b5(standalone, J2SE1.3, winnt40):
>
> * cases:
> -
> % put the Same MyServlet.class in WEB-INF/classes in
> Different "Context path" which has Different "Context docBase"
> % put the Same MyServlet.class in the Same MyJar.jar file in
> WEB-INF/lib in
> Different "Context path" which has Different "Context docBase"
>
> % put the Same MyUtility.class in WEB-INF/classes in
> Different "Context path" which has Different "Context docBase"
> % put the Same MyUtility.class in the Same MyJar.jar file in
> WEB-INF/lib in
> Different "Context path" which has Different "Context docBase"
>
> -
> % put the Same MyServlet.class in WEB-INF/classes in
> Different "Context path" which has Same "Context docBase"
> % put the Same MyServlet.class in the Same MyJar.jar file in
> WEB-INF/lib in
> Different "Context path" which has Same "Context docBase"
>
> % put the Same MyUtility.class in WEB-INF/classes in
> Different "Context path" which has Same "Context docBase"
> % put the Same MyUtility.class in the Same MyJar.jar file in
> WEB-INF/lib in
> Different "Context path" which has Same "Context docBase"
>
> * in all the above cases, all MyServlet/MyUtility of different
> "Context path"(NOT "Context docBase") are different in the
> follwing way:
> - classloader: this.getClass().getClassLoader().hashCode()
> - Class object: this.getClass().hashCode()
> (so/then), I can seprate all the "public static field" in
> MyServlet/MyUtility by
> different "Context path"(NOT "Context docBase"), i.e. :
> % I can set "it is 0" to a "public static String field"->MyField
> in MyServlet/MyUtility
> of "Context path0", and use it within "Context path0"
> % I can set "it is 1" to a "public static String field"->MyField
> in MyServlet/MyUtility
> of "Context path1", and use it within "Context path1"
> - i.e., "Context path"/webappClassLoader/"Class object"/"static
> field"
> is "independent" to the following:
> % "Context docBase"
> % .class file/.jar file
>
> and please notice that jar file in WEB-INF/lib can not be auto-reloaded,
> so if you
> update a jar file in WEB-INF/lib, you need to re-start TC4.0-b5.
>
>
> Bo
> June 13, 2001
>
>
>
>
>