0

What i am doing is serializing a class and store it in database, then reading it and deserialize it using SpringFramework, and getting an exception on deserialization bytes into class.

Exception:

java.lang.IllegalArgumentException: Failed to deserialize object
    at org.springframework.util.SerializationUtils.deserialize(SerializationUtils.java:68)
..
...
....
 Caused by: java.io.StreamCorruptedException: invalid stream header: BB656430
     at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804)
     at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
     at org.springframework.util.SerializationUtils.deserialize(SerializationUtils.java:64)

Deserialization process:

MyClass formObject2 = (MyClass) SerializationUtils.deserialize(dbData);

I Serialization isn't important in this process but let have for hint

byte[] data = SerializationUtils.serialize(myForm);

More

  • Obviously MyClass implements java.io.Serializable
  • When i try this as a JavaApplication using spring-core-3.2.0-RELEASE.jar it is working fine. But on server it throws this exception.
  • My wild guess is jars are conflicting at runtime, but I couldn't find it so far.
  • My database column is BINARY, bytea
Leonardo Alves Machado
  • 2,747
  • 10
  • 38
  • 53
Sarz
  • 1,970
  • 4
  • 23
  • 43

0 Answers0