Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.io.NotSerializableException on play.api.libs.json.ImmutableLinkedHashMap #944

Closed
ramazanyich opened this issue Oct 30, 2023 · 6 comments

Comments

@ramazanyich
Copy link
Contributor

We have a redis cache implementation on our scala project to perform caching of some objects.
It has an api similar to PlayCache api and it worked with play-json 2.9.4.
Internally we use the java serialization (via ObjectInputStream/ObjetOutputStream) during call to redis set/get operations.
We are migrating to latest Play 2.9.0 version and the play-json 2.10.2 . And after migration during serialization we got following exception if serialized object contains JsObject as it's member (or child member contains JsObject...)
Can you mark play.api.libs.json.ImmutableLinkedHashMap as serializable ?

Caused by: java.io.NotSerializableException: play.api.libs.json.ImmutableLinkedHashMap
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1187)
at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1572)
at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1529)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1438)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1181)
at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1572)
at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1529)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1438)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1181)
at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1572)
at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1529)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1438)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1181)
at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:350)
at io.waylay.redis.RedisCache$.anySerialize(RedisCache.scala:43)
at io.waylay.redis.RedisCache$.io$waylay$redis$RedisCache$$$anonfun$vSerializer$1(RedisCache.scala:26)
at io.waylay.redis.RedisCache$$anonfun$2.serialize(RedisCache.scala:26)
at redis.api.strings.Set.<init>(Strings.scala:125)
at redis.commands.Strings.set(Strings.scala:81)
at redis.commands.Strings.set$(Strings.scala:76)
at redis.RedisClient.set(Redis.scala:78)
at io.waylay.redis.RedisCache.set(RedisCache.scala:64)
@mkurz
Copy link
Member

mkurz commented Oct 30, 2023

Can you please provide a pull request?

@ramazanyich
Copy link
Contributor Author

@mkurz can you take a look on created PR ?

@mkurz
Copy link
Member

mkurz commented Nov 2, 2023

Yes I will.

@mkurz mkurz closed this as completed Nov 4, 2023
@mkurz
Copy link
Member

mkurz commented Nov 4, 2023

Released 2.10.3 and 3.0.1 (later one will be on Maven central in like 30 minutes).

@ramazanyich
Copy link
Contributor Author

thanks a lot ! our project build is now working with 2.10.3 version of play-json

@mkurz
Copy link
Member

mkurz commented Nov 6, 2023

thanks a lot ! our project build is now working with 2.10.3 version of play-json

Perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants