You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hui Linn <hu...@brel.com> on 2000/12/07 08:35:01 UTC

java.lang.ClassCastException

Hi,

This an intermitten problem that crops up once in a while.
A java object SearchResult is put into the Session object
by servlet1 and taken out by servlet2 which type cast it back
to (SearchResult), if it's not null.

Ocassionally, servlet2 will throw java.lang.ClassCastException.
However, the object retrieved is not null and it IS the
correct casting.

Did anyone encounter this before? Is there anything I might
have overlooked? 

Thanks.

Cathy


Re: java.lang.ClassCastException

Posted by Jon Skeet <jo...@peramon.com>.
> This an intermitten problem that crops up once in a while.
> A java object SearchResult is put into the Session object
> by servlet1 and taken out by servlet2 which type cast it back
> to (SearchResult), if it's not null.
> 
> Ocassionally, servlet2 will throw java.lang.ClassCastException.
> However, the object retrieved is not null and it IS the
> correct casting.
> 
> Did anyone encounter this before? Is there anything I might
> have overlooked? 

Is it perhaps due to a new classloader being used? Does this happen when
the servlet is recompiled half way through the operation?

Jon