0

I can't go through the simplest example of serialization using Kryo on scala. Do i need to register a specific serializer for this? thanks

 val kryo  = new Kryo()
    kryo.setRegistrationRequired(false)
    kryo.register(classOf[scala.Tuple2[Any, Any]])
    val intstringtuple = (100, "somestring")
    val outStream = new ByteArrayOutputStream()
    val output = new Output(outStream)
    kryo.writeClassAndObject(output, obj)
    output.flush()
    val input = new com.esotericsoftware.kryo.io.Input(new ByteArrayInputStream(outStream.toByteArray))
    val obj1 = kryo.readClassAndObject(input)
Jeff Saremi
  • 2,674
  • 3
  • 33
  • 57

1 Answers1

0

Adding something like the following solves the issue:

kryo.register(classOf[scala.Tuple2[Any, Any]], new com.twitter.chill.Tuple2Serializer)
Jeff Saremi
  • 2,674
  • 3
  • 33
  • 57