Help reg. serialization compatibility

Hi,

We developed a web-application using J2SE 5.0. It runs in IBM Websphere 6.1(with IBM JRE 5.0). We have an applet for rendering our reports. The applet communicates with the web-application to obtain serialized form of the data that needs to be rendered in the applet. The browser in the customers' site runs jre 1.3.0 as they use other applications that depend upon it. Hence, we migrated the applet to run with jre1.3. This seems to work fine.

My question is how does jre1.3 able to deserialize the data generated by IBM jre 1.5? Is this a mere coincidence? Are there any issues to be noted while deserializing the data generated by a newer version of jre, using an older version?

The serialized data that I had mentioned is generated by a third-party library. Also, our applet is a wrapper around the third-party applet. So, I have no idea as to what kind of data is being exchanged between the servlet and the applet.

Thanks in advance..

[977 byte] By [Anand.Ramana] at [2007-11-27 10:02:18]
# 1

The wire protocol for Serialization has not changed since Java 1.1 and the most of the base class library code that is serialization has serialversionUID set and is backward compatible. Therefore older version of JDK can communicate with newer version of the JDK. The only exception to this is Swing components - in the JavaDoc it has been documented that serialised Swing data is only suitable for short term storage or RMI between application.

Most of the problem you would encounter with serialization between JDK release is actually in the application code. If you have forgot to set serialVersionUID then the JDK will generate one for you using the default field hashing algorithm in serialization library at runtime. This changes from release to release and therefore would break between the release. Therefore, always remember to put serialVersionUID in any classes that can be serialised in your application.

sunnychangsa at 2007-7-13 0:36:36 > top of Java-index,Core,Core APIs...
# 2
> the default field hashing algorithm in serialization library at runtime. This changes from release to releaseNo it doesn't, not if you mean the algorithm, but something about the class itself may change from release to release, which would break serialization-compatibility.
ejpa at 2007-7-13 0:36:36 > top of Java-index,Core,Core APIs...