- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
MapLike.DefaultValuesIterable is not serializable
Thu, 2012-02-16, 17:07
Hi guys,
I have mutable Map (scala.collection.mutable.LinkedHashMap actually). It is populated with key-values pairs ant then its values collection (scala.collection.Iterable) is converted to java.util.Collection and set into legacy Java object:
lazy val taxMap: Map[A, B] = new LinkedHashMap[A, B]...populateTaxMap(taxMap)...postingDTO.setAmounts(taxMap.values.asJavaCollection)
The problem is that when this legacy DTO object is sent to another service via network, NotSerializableException is thrown:
java.io.NotSerializableException: scala.collection.MapLike$DefaultValuesIterable is not serializable
Could you please advise what the reason of this problem is?
Thanks,Vladimir
I have mutable Map (scala.collection.mutable.LinkedHashMap actually). It is populated with key-values pairs ant then its values collection (scala.collection.Iterable) is converted to java.util.Collection and set into legacy Java object:
lazy val taxMap: Map[A, B] = new LinkedHashMap[A, B]...populateTaxMap(taxMap)...postingDTO.setAmounts(taxMap.values.asJavaCollection)
The problem is that when this legacy DTO object is sent to another service via network, NotSerializableException is thrown:
java.io.NotSerializableException: scala.collection.MapLike$DefaultValuesIterable is not serializable
Could you please advise what the reason of this problem is?
Thanks,Vladimir
Thu, 2012-02-16, 19:41
#2
Re: MapLike.DefaultValuesIterable is not serializable
Thanks for the feedback, Alex!
Vladimir
Vladimir
Thanks for reporting, I've added it to an issue with a few similar cases.
-0xe1a