javax.swing.JComponent serialization incompatibility
Issue
- We are generating Jasper Reports printout on JBoss AS (Red Hat Linux, OpenJDK) and sending generated object to RCP application (Windows, Oracle JDK) to show a preview and print it there. Jasper Reports sometimes embeds JComponent somewhere in generated object.
- javax.swing.JComponent object serialized on one Java implementation is not deserializable on the other implementation, because of difference in value of serialVersionUID.
- The exception when using Java Serialzation is:
java.io.InvalidClassException: javax.swing.JComponent; local class incompatible: stream classdesc serialVersionUID = -1030230214076481435, local class
serialVersionUID = 5858390075012080263
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:579)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at deserializeJC.main(deserializeJC.java:21)
Environment
- JBoss Enterprise Application Platform (EAP) 5.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
