istvan bereti wrote:

> Hi,
>
> I don't know what is wrong but it might be a Tomcat bug...
> My session handling is working fine as long as I don't reload a class. Than
> the object bound to the session is very ugly. I got the object from the
> session and the getClass() says that it's my BoundObject class. But whe I
> try to cast it to (BoundObject) says ClassCastError.
>
> Any idea why?

Hi :-)  sometimes it is because that: after auto-reloading, the original
CL(classloader) of this webapp has been replaced by another New
one, so (basically), if the object which is put into session by you as
an Attibute implements "java.io.Serializable", perhaps you can
avoid some of such problems.

(basically) if you want to put a object into a session as an Attibute,
perhaps it is better to make it Serializable, it will be good for the
following:
- cross auto-reloading of one special webapp
- cross TC-restarting(after restating TC, I still can get this Attribute)
- cross multi-TC instances(?)

for example, with TC4.0-b5(standalone, SDK1.3, winnt40):
- if I put a "Serializable object" into a session, And the class-file of this
   object is in WEB-INF/classes, or in a jar file in WEB-INF/lib,
  I found I can do the following:
   cross auto-reloading of one special webapp

- if I put a "Serializable object" into a session, And the class-file of this
   object is in a jar file in TOMCAT_HOME/lib(loaded by ShareCL),
   I found I can do Both the following:
     cross auto-reloading of one special webapp
     cross TC-restarting(after restating TC, I still can get this Attribute)



Bo
June 17, 2001


Reply via email to