tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: It seems new Tomcat33 reloading has a ClassLoader problem
Date Fri, 23 Aug 2002 06:45:25 GMT
This is really going beyond Tomcat's ability to detect.  Beans that want
this much control will need to be life-cycle aware (e.g. implement
javax.servlet.http.HttpSessionBindingListener).  Alternatively, the Bean can
re-load the class when serialized.

That having been said, I'm not really happy with the life-cycle support on
the current patch.  It is currently too closely tied to the
Intercepter/Facade split.  I may make it cleaner later.

----- Original Message -----
From: "Hugh J. L." <hughjlee@yahoo.com>
To: "Tomcat Developers List" <tomcat-dev@jakarta.apache.org>
Sent: Thursday, August 22, 2002 10:42 PM
Subject: Bill: It seems new Tomcat33 reloading has a ClassLoader problem


> Hi,
>
> I wrote a simple class:
>
> public class A implements java.io.Serializable {
>     public void write() {
>         System.out.println("can access" + this);
>     }
> }
>
> and put the class file in WEB-INF/classes. Then I add
> some lines into SessionExample.java:
>
> Object o = session.getAttribute("test");
> if (o == null) {
>     session.setAttribute("test", new A());
> } else {
>     ((A)o).write();
> }
>
> After a context reloading, access to A object in old
> session caused ClassCastException at the line
> ((A)o)...
>
> Then, I tried another way to setAttribute:
>
> Object o = session.getAttribute("test");
> Hashtable t = null;
> if (o == null) {
>     t = new Hashtable();
>     t.put("test", new A());
>     session.setAttribute("test", t);
> } else {
>     t = (Hashtable)session.getAttribute("test");
>     ((A)t.get("test")).write();
> }
>
> It worked well after context reloading.
>
> Can you verify this problem?
>
> Thank you for your contribution to Tomcat and help on
> me.
>
> Regards,
> Hugh
>
> --- Bill Barker <wbarker@wilshire.com> wrote:
> > This should be fixed now.  If you could test the
> > latest nightly, it would be
> > a big help.
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> http://finance.yahoo.com
>
> --
> To unsubscribe, e-mail:
<mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message