tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject RE: The Infamous ClassCastException Problem
Date Fri, 02 Nov 2001 19:20:40 GMT


On Fri, 2 Nov 2001, Frank Lawlor wrote:

> Date: Fri, 2 Nov 2001 13:20:07 -0600
> From: Frank Lawlor <frank.lawlor@athensgroup.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>,
>      frank.lawlor@athensgroup.com
> To: 'Remy Maucherat' <rmaucher1@home.com>,
>      "Tomcat (E-mail)" <tomcat-user@jakarta.apache.org>
> Subject: RE: The Infamous ClassCastException Problem
>
> > This is normal then. Class foo loaded by class
> > loader A is not castable to class foo loaded
> > by class loader B (if they are really independent,
> > of course - if A is the parent of B and B
> > delegates, it will work). You have to
> > put the class in a spot shared by both
> > webapps (that means the shared class loader.
> >
> > Remy
>
> Then how does this work in a general client-
> server relationship such as RMI servers, EJB
> servers, etc.  Don't they usually just give
> you a jar with the classes that you add to
> your client?
>

> Having to use the exact same file seems
> excessive???!  Isn't there some way to allow
> use of a copy of the class?
>

The only way to use one copy of a class between webapps is to put that
class in a *parent* classloader -- for Tomcat, that means put the shared
class in the "lib"  directory, which is loaded into a classloader that is
the parent of the webapp class loader for each app.

For more info on class loading in Tomcat, see:

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html

>  -- Frank
>

Craig


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message