Play 2.5.0 has conflict with gRPC

743 views
Skip to first unread message

党凡

unread,
Mar 6, 2016, 8:53:01 AM3/6/16
to play-framework
Play 2.5.0 uses Netty 4.0.33, while gRPC requires Netty 4.1.0 (for http2 support), which causes the following exception:

[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.AbstractMethodError: null
at io.netty.util.ReferenceCountUtil.touch(ReferenceCountUtil.java:73)
at io.netty.channel.DefaultChannelPipeline.touch(DefaultChannelPipeline.java:84)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:154)
at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:131)
at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:154)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:154)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83)
[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.util.NoSuchElementException: http-handler-body-publisher
at io.netty.channel.DefaultChannelPipeline.getContextOrDie(DefaultChannelPipeline.java:1050)
at io.netty.channel.DefaultChannelPipeline.remove(DefaultChannelPipeline.java:379)
at com.typesafe.netty.http.HttpStreamsHandler.handleReadHttpContent(HttpStreamsHandler.java:191)
at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:167)
at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:154)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:154)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83)

Is there any quick fix that I can try now? Thanks!

Nico Huysamen

unread,
Mar 6, 2016, 10:52:47 PM3/6/16
to play-framework
I have also come across this in Play Java.  Are you using a gRPC client or server?  If you are just using a client you can overcome this by using the OKHTTP client version instead of one that relies on Netty.  If you are using a server, I think you might be out of luck.  You can try to exclude Netty from gRPC and hope Play's version is sufficient.  Just add excludeAll ExclusionRule(organization = "io.netty") to the gRPC import.

党凡

unread,
Mar 6, 2016, 11:02:04 PM3/6/16
to play-framework
Well, I'm using a gRPC client however I need to use TLS support, which requires nettty. As a result, I now downgrade to Play 2.4.6.

在 2016年3月7日星期一 UTC+8上午11:52:47,Nico Huysamen写道:

Dan Di Spaltro

unread,
Oct 25, 2016, 12:56:27 AM10/25/16
to Play Framework
For the record, here's the magic I go through to use a GRPC service from play 2.5.x.

The gist is, basically I shade everything, create a separate project that depends on the grpc, then import that module in.

You can see a semi-working example here https://github.com/dispalt/vitess-client
Message has been deleted

Christian Schmitt

unread,
Oct 25, 2016, 3:29:02 AM10/25/16
to Play Framework
Well you guys can use the akka http server and remove play-ws from your project, than you can happily use GRPC.
akka http is marked as experimental, but it isn't really that much slower than netty. and I doubt that the API won't change much in the upcoming version.

Kenji Yoshida

unread,
Feb 9, 2018, 1:03:16 AM2/9/18
to Play Framework
You can use grpc-netty-shaded since grpc-java 1.9

https://github.com/grpc/grpc-java/pull/2485
Reply all
Reply to author
Forward
0 new messages