Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes I/O and Streams and the fly likes can't deserialize in Java 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "can Watch "can New topic

can't deserialize in Java 6

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
On one computer (with Java 6) I was working on a file, then I saved it (serialized it) and then transferred it to another computer with Java 1.4. I had no problem opening the file and serializing it again in Java 1.4. But then I transferred it to the Java 6 computer and tried to open it, I got this message: invalid handle value: 005E39C7
at Source)
and some other Exception detail lines which include
at java.util.TreeMap.buildFromSorted(Unknown Source)

The object I want to read is of a class which is compiled by code which I wrote. That class contains TreeMap objects which are to be serialized as part of the object. What I think is that somehow TreeMap in java 1.4 differs from TreeMap in java 6.
I would expect java 1.4 not to be able to open an object serialized by java 6, but I did not expect that java 6 could not open an object serialized by java 1.4.

I don't know if this makes any difference, but the .class files were created this way: I have some text files *.java and I compiled the files twice, once on each of the two computers.

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
I think I know what the problem was. I went back to the computer with java 1.4 on it and tried opening both the file saved on that computer, and the file which was copied over to the flash memory. The file saved on the computer opened fine, but the file on the flash memory gave the same Exception message. So I think the file became corrupted when transferred to the flash memory. So it's not a problem with java.
Never mind!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I think it's more likely to be a version problem - serialization using object streams generally doesn't work if two different JRE versions are involved at the two ends.
I agree. Here's the link:
subject: can't deserialize in Java 6
jQuery in Action, 3rd edition