You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dola Woolfe <do...@yahoo.com> on 2008/05/17 06:16:37 UTC
InvalidClassException between Tomcat and Eclipse
Hi,
I get
java.io.InvalidClassException
when I send a serialized class from an application
launched by Eclipse to a JSP page, compiled by the
server.
I thought that serialVersionUID was strictly a
function of members, signatures, etc - but that
doesn't appear to be the case.
A workaround is to define serialVersionUID explicitly,
but I would like to understand what's going on.
Many thanks in advance!
Dola
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: InvalidClassException between Tomcat and Eclipse
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dola Woolfe [mailto:dolachin@yahoo.com]
> Subject: Re: InvalidClassException between Tomcat and Eclipse
>
> Can you explain the idea behind serialVersionUID
AFAIK, its primary purpose is to insure that the deserialized object is
compatible with the the current class definition. Serializable classes
distributed with the JRE have explicit serialVersionUID values, and are
changed whenever the class implementation changes - not just when
methods or fields are updated. It's usually not safe to depend on the
automatically generated ID value, since logic changes could produce
incompatibilities; best to always set your own and be careful to
increment it whenever modifying the class (I think some of the IDEs will
do this for you).
Look here, especially section 4.6:
http://java.sun.com/javase/6/docs/platform/serialization/spec/class.html
- 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: InvalidClassException between Tomcat and Eclipse
Posted by Dola Woolfe <do...@yahoo.com>.
Thanks.
Can you explain the idea behind serialVersionUID (or
point to a link)?
It seems (under ideal circumstances and not what I was
conerned with previously) that if the classes are
legitimately out of sync and I don't set it, I will
get an exception saying that serialVersionUID is
mismatched. If I do set it, I will get an invalid
stram exception or something like that. I don't
particularly care what exception I get.
Thanks!
Dola
--- Yuval Perlov <yu...@r-u-on.com> wrote:
> It is also affected by the compiler version.
>
> It is most advisable to add serialVersionUID
>
> Yuval Perlov
> www.r-u-on.com
>
> On May 17, 2008, at 7:16 AM, Dola Woolfe wrote:
>
> Hi,
>
> I get
>
> java.io.InvalidClassException
>
> when I send a serialized class from an application
> launched by Eclipse to a JSP page, compiled by the
> server.
>
> I thought that serialVersionUID was strictly a
> function of members, signatures, etc - but that
> doesn't appear to be the case.
>
> A workaround is to define serialVersionUID
> explicitly,
> but I would like to understand what's going on.
>
> Many thanks in advance!
>
> Dola
>
>
>
>
>
---------------------------------------------------------------------
> To start a new topic, e-mail:
> users@tomcat.apache.org
> To unsubscribe, e-mail:
> users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail:
> users-help@tomcat.apache.org
>
>
>
>
>
---------------------------------------------------------------------
> To start a new topic, e-mail:
> users@tomcat.apache.org
> To unsubscribe, e-mail:
> users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail:
> users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: InvalidClassException between Tomcat and Eclipse
Posted by Yuval Perlov <yu...@r-u-on.com>.
It is also affected by the compiler version.
It is most advisable to add serialVersionUID
Yuval Perlov
www.r-u-on.com
On May 17, 2008, at 7:16 AM, Dola Woolfe wrote:
Hi,
I get
java.io.InvalidClassException
when I send a serialized class from an application
launched by Eclipse to a JSP page, compiled by the
server.
I thought that serialVersionUID was strictly a
function of members, signatures, etc - but that
doesn't appear to be the case.
A workaround is to define serialVersionUID explicitly,
but I would like to understand what's going on.
Many thanks in advance!
Dola
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org