When deserializing a serialized object (from a file) using Kryo, I get the following exception:
java.lang.ExceptionInInitializerError (...) Caused by: com.esotericsoftware.kryo.KryoException: (...) Serialization trace: (...) at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125) at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528) at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:786) at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:143) at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:21) at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:682) (...) Caused by: java.lang.IndexOutOfBoundsException: Index: 1582, Size: 2 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at com.esotericsoftware.kryo.util.MapReferenceResolver.getReadObject(MapReferenceResolver.java:42) at com.esotericsoftware.kryo.Kryo.readReferenceOrNull(Kryo.java:830) at com.esotericsoftware.kryo.Kryo.readObjectOrNull(Kryo.java:753) at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:113) ... 27 more
My hypothesis is that a serialized format is misunderstood when deserializing (i.e. changing). The version of Kryo for serialization and deserialization was the same. The Java version could be different during serialization: could this be an explanation?
If not, any other hints that mine throw such exceptions are more than welcome!
Thanks a lot, Thomas
UPDATE: as suggested, thereby a class that is deserialized from a file
The main deserialized class is HashMap<Integer, PreflopEhsVO> where user-defined class definitions (child and parent):
public class PreflopEhsVOExtended extends PreflopEhsVO{ private int numbValues = 0; public synchronized void addValue(PreflopEhsVO values){ if (numbValues == 0) this.valuesPerNumbOpp = values.valuesPerNumbOpp; else{
source share