struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Please help clarify or confirm -- HttpSession
Date Thu, 13 Jun 2002 19:00:11 GMT

> > Second, having common
> > directories on the two CLASSPATHS for the two webapps allows you to
> > CLASSES to create new objects, but not to share the objects once they
> > created.

> True, but not what I suggested at all.  Two webapps sharing a common
> CLASSPATH is far different from them having access to a common
> (shared,parent) CLASSLOADER.  In the former two different classloaders
> loading the same class into two different "memory spaces", as you say.
> the latter, a parent classloader is loading a class into a "memory space"
> accessible by either of the two child classloaders for the webapps.  So I
> fail to see why a static class with static resources loaded by this
> classloader will not enable objects to be shared between the two child
> classloaders, so long as the objects themselves are also created from
> classes loaded by the shared classloader.
> Note that I am also not claiming that this will 100% work, I just don't
> why it wouldn't.

Sorry, misunderstood you.

I'm not sure if this would work either, but I follow your logic. Seems like
it would be easy to try. Just create a simple static class holding a
counter and then hit two diff web apps that increment and display its

Looking at: it
looks as it the Classloader Hierarchy in Tomcat 4.1 (per the Servlet Spec
2.3 sections 9.4 & 9.6) provides exactly this functionality.

It even says that the "shared" class loader exists for "classes and
resources that you wish to share across ALL web applications".

So as long as you've got a 2.3 compliant container and you can get the
functionality you need from a static class, then this should work.

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

View raw message