File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "can Watch "can New topic
Author

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:
java.io.StreamCorruptedException: invalid handle value: 005E39C7
at java.io.ObjectInputStream.readHandle(Unknown 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.

Help!
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
Marshal

Joined: Mar 22, 2005
Posts: 39530
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't deserialize in Java 6
 
Similar Threads
regarding serialization
Can not compile the jsp file
serialized objects in old versions of java
Applet doesn't load
Applet in JSP