tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <>
Subject AW: Are static vars VM dependend or ClassLoader dependend [offtopic]
Date Wed, 19 Jun 2002 12:06:38 GMT
Haven't tried that, as we just use one context, but as I 
understand it, it's the following way:

It depends on where you place the class file or the jar file
that holds the class that implements the singleton.

If you place it in <CATALINA_BASE>/webapps/<context>/WEB-INF/lib
or <CATALINA_BASE>/webapps/<context>/WEB-INF/classes then each 
webapp should have his own singleton. 

If you place the class outside the webapp (<CATALINA_BASE>/lib
or <CATALINA_BASE>/classes or <CATALINA_HOME>/common/lib or
<CATALINA_HOME>/common/classes) all webapps in the same VM should 
share the singleton.

Also have a look at
(I think this document says <CATALINA_HOME> at some places where 
<CATALINA_BASE> would be more correct if they point to different 

> -----Urspr√ľngliche Nachricht-----
> Von: Stefan Langer []
> Gesendet: Mittwoch, 19. Juni 2002 13:14
> An: Tomcat-User-Maillist
> Betreff: Are static vars VM dependend or ClassLoader dependend
> [offtopic]
> Stated differently is the static variable the
> same for each webapplication in the Tomcat instance or does 
> each Context have its own copy of the static since each 
> context is loaded by a different classloader. As far as my 
> testing has gotten I think that the static is only available 
> once in the Tomcat installation.
> Can anybody confirm this or for that deny it??

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message