Everything works fine as long as you dont reload a class right? I would
suggest that what you have is perfectly understandable. You create an
object and put it in the session, based on one set of bytecode. You
then replace the bytecode with new bytecode, and the JVM is trying to
access the object as type of the second set of bytecode. That's where
your problem is occuring. I dont think this is a Tomcat bug, just a
limitation on how much dynamic classloading can do - you cant expect it
to automatically migrate old objects to new versions of the same type.
I'm guessing what might be happening is you make a small change to
something not related to this object, and then recompile. Its
understandable that you dont expect any changes to the object we're
talking about, but because you've recompiled all the classes, we have
this problem. You can get around this by using something like ant that
only recompiles changed files. That way you only reload the classes you
need to.
hope this helps
cheers
dim
istvan bereti wrote:
>
> If I get the bound object from the session right after I put it in it's
> correct. But after the first request with the same session I got the
> ClassCastError.
> Has anyone experienced the same?
> The same code worked perfectly with JServ.
>
> 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?