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




On Nov 29, 2007, at 3:00 PM, Adrian Bartholomew wrote:

I have a client/server app using an object called User that implements Serializable in the shared package.
Everything worked perfectly up until i added an ArrayList of class UserStatus to the User members.
Now I keep getting:
java.io.InvalidClassException: User; local class incompatible: stream classdesc serialVersionUID = xxxxxxxxxxxxx, local class serialVersionUID = yyyyyyyyyyyy

In my experience that message means that the implementation of the class that is deserializing the object doesn't have the same implementation of the class that serialized the object. This can happen if you write your object to disk, change the object's class' signature, then try to read the object back from disk. If you don't specify serialVersionUID one gets computed from the class' signature. If you didn't have a serialVersionUID when you serialized the object, then added your ArrayList, then ran serialver to determine the serialVersionUID, you'll get a different serialVersionUID than the one that was used when the object was serialized.
--
Rick Genter
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: 
 >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.