This page is no longer maintained — Please continue to the home page at www.scala-lang.org

MapLike.DefaultValuesIterable is not serializable

2 replies
lester 2
Joined: 2011-07-26,
User offline. Last seen 42 years 45 weeks ago.
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
Alex Cruise
Joined: 2008-12-17,
User offline. Last seen 2 years 26 weeks ago.
Re: MapLike.DefaultValuesIterable is not serializable
On Thu, Feb 16, 2012 at 8:07 AM, lester <lester.mail@gmail.com> wrote:
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

Thanks for reporting, I've added it to an issue with a few similar cases.
-0xe1a
lester 2
Joined: 2011-07-26,
User offline. Last seen 42 years 45 weeks ago.
Re: MapLike.DefaultValuesIterable is not serializable
Thanks for the feedback, Alex!
Vladimir

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland