GeezerVison is showing github.com — Using Pub/Sub JAVA client in play framework 2.5 - netty conflicts · Issue #1331 · googleapis/google-cloud-java
Using Pub/Sub JAVA client in play framework 2.5 - netty conflicts #1331DescriptionIssue summary: Client's services are built on top of the play framework 2.5. Some of their services need to publish messages to pub/sub, but the Google Pub/Sub java api depends on netty 4.1.x, which conflicts with netty 4.0.x used by play framework 2.5.
Is there a solution to get around this? Reacted by Matt Feury and Les Vogel Activitymziccard commented on Oct 21, 2016 Argh @thefunkjunky I need to be honest with you, I was expecting this issue...
This is a problem with gRPC (a dependency of ours) and Play 2.5. gRPC depends on netty 4.1, while Play 2.5 depends on netty 4.0. Unfortunately, these 2 netty versions are not binary compatible.
A possible solution (see stackoverflow) could be downgrading to Play 2.4.6 which uses netty 3.8.0 that had a completely different project structure and package names (hence no name clashes).
Play 2.6 should ship with netty 4.1 and possibly solve this issue.
@garrettjonesgoogle do you know whether gRPC people considered shading some of their dependencies? There seem to be a number of people encountering this compatibility issues. garrettjonesgoogle commented on Oct 21, 2016 I don't know - @ejona86 , can you comment? ejona86 commented on Oct 21, 2016 So shading is a fine strategy, but since Netty is exposed through our API (e.g., you can provide your own EventLoopGroup to NettyChannelBuilder), gRPC project pre-shading can cause problems. garrettjonesgoogle commented on Jan 26, 2017 ejona86 commented on Jan 27, 2017 I have since made grpc/grpc-java#2485. It's not submitted yet, and if you use NettyChannelBuilder directly it doesn't work well, but we can maybe push harder on that.
Guava is a different story. Would I be right to assume issues are caused by the ancient guava-jdk5 used by the v1 client libraries? garrettjonesgoogle commented on Jan 27, 2017 The issue with Guava isn't the guava-jdk5 dependency, it is a larger issue with the Guava deprecation policy. Basically as soon as we pick a particular version of Guava and expose types from it, that means no one can mix our library with a version of Guava that is 2 years older or 2 years newer than the version we picked. There are a fair number of consumers that this doesn't work for, e.g. Hadoop which is stuck on Guava 11. Reacted by Tsz-Wo Nicholas Sze ejona86 commented on Jan 27, 2017
and expose types from it
You can't do that at all, if you are going to shade. So for example, it is hard to shade Guava for gRPC when the Future stub is in play, because it uses ListenableFuture but if we shade ListenableFuture then none of the normal utilities will work and users have to use our shaded version. garrettjonesgoogle commented on Jan 27, 2017 ejona86 commented on Jan 31, 2017
Hadoop which is stuck on Guava 11.
I think the argument there is that Hadoop should be shading/using class loading magic (a la containers). Because without doing so nobody can mix Hadoop and Guava. But I do understand the general "exposing a dependency on Guava can cause problems" argument.
Our plan was to create an interface analogous to ListenableFuture called RpcFuture
Okay. And then your users can create their own utility to convert that to a ListenableFuture.
What do you mean by "the normal utilities?"
I mean things like cgc.util.concurrent.Futures. There are a lot of generic utility methods that do things with ListenableFutures.
make a bridge from ListenableFuture to RpcFuture called ListenableFutureDelegate
That's an implementation detail, right? The user of your library doesn't care about that at all, right?
Note that any reason you are using ListenableFuture in your code could be an example of why your users would want ListenableFuture. garrettjonesgoogle commented on Jan 31, 2017
Hadoop which is stuck on Guava 11.
I think the argument there is that Hadoop should be shading/using class loading magic (a la containers). Because without doing so nobody can mix Hadoop and Guava. But I do understand the general "exposing a dependency on Guava can cause problems" argument.
Hadoop's problem isn't just that it depends on Guava, it's that it made Guava part of its surface, so if it upgrades to a newer version of Guava, it's a breaking change for its users. If it was only an implementation detail, they could have done something like shading Guava a long time ago.
Our plan was to create an interface analogous to ListenableFuture called RpcFuture
Okay. And then your users can create their own utility to convert that to a ListenableFuture.
I was considering creating a "bridge" project that depends on Guava and connects GAX features to Guava, so that each user doesn't have to do it themselves.
What do you mean by "the normal utilities?"
I mean things like cgc.util.concurrent.Futures. There are a lot of generic utility methods that do things with ListenableFutures.
Right, but people don't have to use those utilities. This could be addressed with the "bridge" project I mentioned above.
make a bridge from ListenableFuture to RpcFuture called ListenableFutureDelegate
That's an implementation detail, right? The user of your library doesn't care about that at all, right?
That is correct.
Note that any reason you are using ListenableFuture in your code could be an example of why your users would want ListenableFuture.
The key thing that comes out of ListenableFuture is the capability of adding a callback so that a thread isn't consumed. I don't think the key is so much that exact interface as that we provide the callback capability. kuroneko25 commented on Feb 9, 2017 I ran into a similar issue where I use grpc-all 1.1.2 and google-cloud-pubsub in the same project. Is this going to be addressed by grpc/grpc-java#2485?
Specifically this exception
Exception in thread "main" java.lang.NoSuchMethodError: io.grpc.netty.NettyChannelBuilder.build()Lio/grpc/internal/ManagedChannelImpl;
at com.google.api.gax.grpc.InstantiatingChannelProvider.createChannel(InstantiatingChannelProvider.java:119)
at com.google.api.gax.grpc.InstantiatingChannelProvider.getChannel(InstantiatingChannelProvider.java:106)
at com.google.api.gax.grpc.ProviderManager.getChannel(ProviderManager.java:106)
at com.google.api.gax.grpc.ChannelAndExecutor.create(ChannelAndExecutor.java:67)
at com.google.api.gax.grpc.ClientSettings.getChannelAndExecutor(ClientSettings.java:78)
at com.google.cloud.pubsub.spi.v1.PublisherClient.<init>(PublisherClient.java:182)
at com.google.cloud.pubsub.spi.v1.PublisherClient.create(PublisherClient.java:173)
pongad commented on Feb 9, 2017 If I understand this correctly, the answer is yes.
The exception is NoSuchMethod not NoClassDef. So I'm guessing
- grpc and gax depends on different versions
- grpc's version takes precedence
- grpc's version doesn't have the
build() method we need
Once that issue is addressed, things will work together again.
ccing @garrettjonesgoogle to make sure I'm diagnosing this correctly.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|