clanz wrote:yes you do change it. adding/removing the static File reference changes the "default" serialVersionUID. even though static values are not serialized, the default serialVersionUID algorithm must be sensitive to those changes.
Having read every relevant post I could find, I am aware that one must not change the classes involved with the serialized objects - and I don't. I have also tried hard-coding the serialVersionUID. The books I have go into the kind of serialization code I use, but don't discuss this pitfall.
clanz wrote:yes, this is the solution. you say "it made no difference". it made some difference. what error did you get after you did this?
I have already explicitly declared the serialVersionUID in each serializable class, and it made no difference. It's possible I'm doing it wrong, though: I took it literally when the oracle docs said to use explicit UIDs in every serializable class, and so I put their line in each class:
private static final long serialVersionUID = 15L;
I gave each class a different longint value. From what I've read this seems to be the thing to do, but I'm still uncertain.
clanz wrote:i doubt that. if you created the serialVersionUIDs correctly, then the new ids should be mentioned in the error message. if not, then you didn't create them correctly. if so, then the problem is that you have existing serialized data without the explicit uids, in which case (assuming the old class data is compatible), then you should make the explicit serialVersionUIDs the same as the old, implicit ones.
The error is exactly the same with and without explicit serialVersionUIDs.
Sorry, I mis-spoke again. The error remained unchanged in every aspect of its overt behavior, after adding the UIDs. The same changes in the code can cause de-serialization to fail. Further, the stack trace is character-for-character exactly the same regardless of the presence or absence of the explicit UIDs.
local class serialVersionUID = 190094503397420067If the source code of the local class has a different value for the private static long serialVersionUID than what appears in the error message, you aren't using the corresponding .class file at execution time, or else it isn't static and long.