I am running into the following NullPointerException: com.esotericsoftware.kryo.KryoException: java.lang.NullPointerException Serialization trace: underlying (scala.collection.convert.Wrappers$JListWrapper) myArrayField (MyCaseClass) at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
I have been running into similar issues when using avro classes, that I was able to resolve by registering them with a Kryo serializer that uses chill-avro. However, in this case the field is in a case class and it seems that registering the class does not help. I found this stack overflow that seems to be relevant: http://stackoverflow.com/questions/23962796/kryo-readobject-cause-nullpointerexception-with-arraylist I have this line of code translated to Scala, that supposedly solves the issue: val kryo = new Kryo() kryo.getInstantiatorStrategy().asInstanceOf[Kryo.DefaultInstantiatorStrategy].setFallbackInstantiatorStrategy(new StdInstantiatorStrategy()) However, I am not sure where this line should be placed to take effect. I already have the following, should it go somewhere in here? class MyRegistrator extends KryoRegistrator { override def registerClasses(kryo: Kryo) { kryo.register(...) } } Simone Franzini, PhD http://www.linkedin.com/in/simonefranzini