Hello,
I am using kryo serializer 3.0.2, to serialize an array of objects with class type (ClassFoo), from one process (A) and then pass the serialized result to the other process (B).
To do so, on both processes, I register the class (ClassFoo) for the objects. Then on Process A, I used "writeClass" for ClassFoo , then I shipped the bytes of the serialized results to Process B. After serializing the class definition, on Process A, I started to write a sequence of the objects (Object 1, Object 2, Object 3....) that have the same type ClassFoo, using the method "writeObject". Then I got the bytes of the serialized objects at Process A, and then I passed the bytes to Process B.
On Process B, I can use "readClass" to turn the serialized bytes for ClassFoo from Process A, to correctly reconstruct ClassFoo.
Then when I used ClassFoo and the input buffer that is constructed from the serialized bytes that represent the serialized objects, to issue the call of: readObject( input, ClassFoo), I got the following exception:
java.lang.IndexOutOfBoundsException: Index: 10, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:635)
at java.util.ArrayList.get(ArrayList.java:411)
at com.esotericsoftware.kryo.util.MapReferenceResolver.getReadObject(MapReferenceResolver.java:60)
at com.esotericsoftware.kryo.Kryo.readReferenceOrNull(Kryo.java:831)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:681)
I inspect the code, it seems that the internal array of MapReferenceResolver is empty, while the class id resolved is 10, and then throws the exception.
If that is the case, what did I miss to prepare the kryo deserializer, such that MapReferenceResolver will have the non-empty internal array?
Thanks for the suggestion!
Jun