[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please help: InvalidClassException



Jörg Prante wrote:
> 
> Eric Richardson wrote:
> 
> >I'm not an expert but did you provide a serialVersionUID in your
> >source for this class?
> >com.sevenval.fit.contract.ozone.OzoneSiteManagerImpl
> 
> >If you look at samples/simple you will see this in the AutoImpl.java
> >file.
> 
> >final static long serialVersionUID = 1L;
> 
> >Since Ozone uses serialization, the serialVersionUID needs to be the
> >same between the
> >stored object and the one used in the runtime which can change after
> >compilation if it is not specified in the class.
> 
> I did this in OzoneSiteManagerImpl:
> 
>       protected static long serialVersionUID = 1L;
> 
> Still I wonder if this UID must be declared as 'final static'. I will try and
> see again.
The JDK guide says
4.4 Stream Unique Identifiers 

Each versioned class must identify the original class version for which
it is capable of writing streams and from which it can read.
For example, a versioned class must declare:

private static final long serialVersionUID = 3487495895819393L;

If you have the jdk javadocs there is a big section
jdk1.2.2/docs/guide/serialization/index.html

Hope this helps,
Eric

> 
> Jörg
> 
> --
> Jörg Prante
> Sevenval AG (HRB 32757) e-business marketing technologies
> D-50667 Köln . Alter Markt 36-42
> Fon +49 221 65 00 70 . Fax +49 221 42 49 891 . Mobile +49 175 466 19 18
> http://www.sevenval.de . joerg@7val.com