tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wingfield <jon.wingfi...@mkodo.com>
Subject Re: ClassCastException while sharing objects accross applications
Date Tue, 04 Oct 2005 16:46:53 GMT
What Chuck says is right.
This approach has a few gotchas though, especially if ClassX is complex 
and references many other objects loaded from the same (WebApp) 
classloader. You can end up with a lot of classes up in the common 
repository. >-o

Make ClassX an interface, if you can. That way only the interface (and 
any referenced types) need go in common. Refactoring here we go :)

HTH,

Jon

Caldarale, Charles R wrote:
>>From: Andrés Glez. [mailto:andres.gonzalez@publicinet.net] 
>>Subject: Re: ClassCastException while sharing objects accross 
>>applications
>>
>>What about using JNDI to share objects between webapps?
> 
> 
> Won't change anything, due to the previously noted classloader-specific casting issue.
 What should work (haven't tried it) is to put the defining class for the object of interest
in shared/classes or shared/lib (if packaged in a jar), and remove it from each webapp.  This
will create the class under a classloader visible to both webapps.
> 
> See:
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html
> for more info.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and
is thus for use only by the intended recipient. If you received this in error, please contact
the sender and delete the e-mail and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message