scala - NotSerializableException for `Map[String, String]` alias -


i'm trying send object remote actor , got exception:

error akka.remote.endpointwriter - transient association error (association remains live) java.io.notserializableexception: scala.collection.immutable.maplike$$anon$2 

the object being serialized case class:

case class locationreport(idn: string, report: string, timestamp: option[string], location: attr, status: attr, alarms: attr, network: attr, sensors: attr) extends message(idn) {    val ts = timestamp getorelse location("fix_timestamp")    def json =     (report ->       ("time" -> ts) ~       ("location" -> location) ~       ("alarms" -> alarms) ~       ("network" -> network) ~       ("sensors" -> ((status ++ sensors) + ("customclock" -> report.decodetimestamp(ts))))) } 

and attr type re-definition:

type attr = map[string, string] 

the message class pretty simple:

abstract class message(idn: string) {   def topic = idn   def json(): jvalue } 

i'm wondering if type alias/redefinition confusing serializer. think i'm using protobuf serialization, see javaserializer in stacktrace.

more debugging info

i newed javaserializer , individually serialized each of maps. 1 (alarms) fails serialize. here's tostring of each of them:

this 1 failed:

alarms = map(lowbattery -> 1373623446000) 

these succeeded:

location = map(a_value -> 6, latitude -> 37.63473, p_value -> 4, longitude -> -97.41459, fix_timestamp -> 3f0ae7ff, status -> ok, fix_type -> msbl, customclock -> 1373644159000) network = map(sid -> 1271, rssi -> 85) sensors = map(humidity -> -999, pressure -> -999, light -> -999  9:52 am) status = map(temperature_f -> 923, cycle -> 4, temperature1_c -> 335, cap_remaining -> 560, voltage -> 3691, cap_full -> 3897) 

the problem map.mapvalues produces object that's not serializable. when alarms created, it's run through alarms.mapvalues(hex2int). problem , workaround described here:

https://issues.scala-lang.org/browse/si-7005

in short, solution alarms.mapvalues(hex2int).map(identity)


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -