I have a way to serialize a java map Map<UUID,String> . It is working fine. I can serialize and deserialize in java.
But I have to call this method from scala, and this is my call code.
def customSerialize:Unit = { Serializer.serialize(modMap(scalaMap)) def modMap(oldMap : Map[UUID,SomeObject]) : java.util.Map[UUID,java.lang.String] = { oldMap map { case(k,v) => (k->v.name)} }
The scala map is scala.collection.Map , and I use import scala.collection.JavaConversions._ to do the conversion.
When I run this code, I get an error
java.io.NotSerializableException: scala.collection.JavaConversions$MapWrapper at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
It looks like I need another conversion from javaconversions$MapWrapper to java.util.Map . It's right? Is there any way to do this?
source share