ReadObject Due to MapReferencesResolver index range checking exception

55 views
Skip to first unread message

Jun Li

unread,
Aug 8, 2015, 4:39:51 AM8/8/15
to kryo-users
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

Nate

unread,
Sep 2, 2015, 8:48:05 PM9/2/15
to kryo-users
I'm afraid we'll need an SSCE to debug this.


--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages