Any interop issues with Play 2.6 (Java) and Kotlin?

88 views
Skip to first unread message

Mike Gee

unread,
Aug 16, 2017, 12:53:12 PM8/16/17
to Play Framework
I am trying to implement a RPC client exposed via a Kotlin API. I have a test client implemented in a plain Java class that successfully makes the RPC calls, but when I try to implement those same calls in a Play controller the server (Kotlin) is throwing serialization errors. This indicates that Play is serializing the outbound RPC payload differently than plain Java. I am trying to configure the server (Kotlin) to shed some light on what the client (Play) is sending, but is there something specific I should look at?

Thanks

Mike

Rich Dougherty

unread,
Aug 17, 2017, 6:42:20 AM8/17/17
to play-framework
Hi Mike

We might need more info to help out here:
- what kind of RPC?
- stack trace
- snippets of code that works in Java / fails in Kotlin

If you're using Java's built-in serialization instead of something more explicit like JSON or protobufs there are all kinds of pitfalls you can encounter.

Cheers
Rich

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/1c4e2d2d-f2bb-4cf0-b028-ea2f9b5f2387%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rich Dougherty
Engineer, Lightbend, Inc

Mike Gee

unread,
Aug 17, 2017, 3:40:21 PM8/17/17
to Play Framework
Hi Rich

Yes, sorry about the lack of detail. I discovered the issue was due to the RPC server using an older version of Guava than my Play 2.6.3 client, and the Kryo deserializer expects the registered classes in a specific order and of course the newer version of Guava was introducing additional, unexpected, registered classes. When I downgraded Play to 2.6.0-RC1 everything started working as expected. 

Thanks for responding.

Mike



Justin du coeur

unread,
Aug 17, 2017, 4:16:26 PM8/17/17
to play-fr...@googlegroups.com
Hmm.  If your Kryo is having problems because of the order, I'd strongly recommend using a more deterministic id registration strategy for your classes; otherwise, this is going to be an ongoing headache for you.  Are you using the romix library on the Scala side?

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.

Will Sargent

unread,
Aug 19, 2017, 1:05:06 AM8/19/17
to play-fr...@googlegroups.com
If you are using Kryo, you should have setRegistrationRequired set and map your classes through:


Otherwise, you have a security vulnerability similar to java deserialization attacks:


Reply all
Reply to author
Forward
0 new messages