> > Second, having common
> > directories on the two CLASSPATHS for the two webapps allows you to
load
> > CLASSES to create new objects, but not to share the objects once they
are
> > 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
are
> loading the same class into two different "memory spaces", as you say.
In
> 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
parent
> 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
see
> 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
value.

Looking at:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html 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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to