java-grpc icon indicating copy to clipboard operation
java-grpc copied to clipboard

AbstractMethodError from gRPC client on 0.1.3

Open vegarsti opened this issue 6 years ago • 1 comments

I'm getting a severe error with 0.1.3. It doesn't happen with 0.1.2 (or other previous versions). I'm using Lightstep, with packages lightstep-tracer-jre which is 0.17.0, and tracer-grpc at 0.18.0. I'm not sure what happens, but it seems to be similar to this previous issue.

Here is the error:

SEVERE: [Channel<1>: (logging.googleapis.com:443)] Uncaught exception in the SynchronizationContext. Panic!
java.lang.AbstractMethodError: io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.newClientTransport(Ljava/net/SocketAddress;Lio/grpc/internal/ClientTransportFactory$ClientTransportOptions;Lio/grpc/ChannelLogger;)Lio/grpc/internal/ConnectionClientTransport;
	at io.grpc.internal.CallCredentialsApplyingTransportFactory.newClientTransport(CallCredentialsApplyingTransportFactory.java:49)
	at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:246)
	at io.grpc.internal.InternalSubchannel.access$400(InternalSubchannel.java:65)
	at io.grpc.internal.InternalSubchannel$2.run(InternalSubchannel.java:196)
	at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
	at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
	at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1365)
	at io.grpc.internal.DnsNameResolver$Resolve.resolveInternal(DnsNameResolver.java:311)
	at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:213)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Any thoughts?

vegarsti avatar Aug 20 '19 11:08 vegarsti

@vegarsti most likely that in your classpath there are several incompatible grpc versions: one from this library, another from tracer-grpc and probably third one from your application. you can check via mvn dependency:tree (if you use maven).

I can propose 2 solutions:

  1. Exclude grpc from this library dependencies:
<dependency>
      <groupId>io.opentracing.contrib</groupId>
      <artifactId>opentracing-grpc</artifactId>
      <version>0.1.3</version>
      <exclusions>
        <exclusion>
          <groupId>io.grpc</groupId>
          <artifactId>grpc-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  1. Don't use tracer-grpc. Instead use tracer-okhttp.

malafeev avatar Aug 20 '19 13:08 malafeev