Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serialization problem



Okay
Make sure you add an explicit public static final long
serialVersionUID to your class - for now set it to 1L;

Then try again, if you're using RMI or jini, ensure you update your
codebase with this class, if you're not and you're using sockets or
similar, make sure the client has the same copy of the class.

If you have a problem you should see that the stream classdesc version
is 1L because the server is running with the class that has the
explicit serialVersionUID value, and the client isn't which means
either you're running an older version of the class (probably a reason
why the serialVersionUIDs are different to start with) or you have an
old version on your classpath that you don't know about

HTH

--Calum

On 29/11/2007, Adrian Bartholomew <email@hidden> wrote:
> Thank you so much for your prompt reply.
> I guess that I was not as concise as I thought I was.
>
> i used x and y just to portray that they were different values.
> y is the value of my hard coded value if I implemented static int
> serialVersionUID = y, an arbitrary value if I did not.
>
> I am using Java1.5 on both client and server.
> I use Leopard.
> I did not include this information because, as I stated, it worked
> perfectly up until i added the ArrayList of UserStatus.
> Therefore, the Serialization of User was version safe.
>
> The error is occurring on the server at:
>                  event = (RemoteEvent) input.readObject();
>
> -- A
>
>
> On Thursday29,Nov 2007, at 5:29 PM, Greg Guerin wrote:
>
> > Adrian Bartholomew wrote:
> >
> >> java.io.InvalidClassException: User; local class incompatible: stream
> >> classdesc serialVersionUID =  xxxxxxxxxxxxx, local class
> >> serialVersionUID = yyyyyyyyyyyy
> >
> > Exactly what values are xxxxxxxxxxxxx and yyyyyyyyyyyy?
> >
> > What version of Java and OS is this on, for each of client and server?
> >
> > And is the exception thrown on the client or on the server?
> >
> >  -- GG
> >
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Java-dev mailing list      (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/java-dev/email@hidden
> >
> > This email sent to email@hidden
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Java-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/java-dev/email@hidden
>
> This email sent to email@hidden
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Serialization problem (From: Adrian Bartholomew <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.