question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.AbstractMethodError: io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.getScheduledExecutorService()Ljava/util/concurrent/ScheduledExecutorService;

See original GitHub issue

I encountered the following stacktrace after I included "com.google.cloud" % "google-cloud-pubsub" % "1.37.1" in my project:

Caused by: java.lang.NoSuchMethodError: io.grpc.okhttp.OkHttpChannelProvider.isAndroid()Z
	at io.grpc.okhttp.OkHttpChannelProvider.priority(OkHttpChannelProvider.java:47) ~[grpc-okhttp-1.0.1.jar:1.0.1]
	at io.grpc.ManagedChannelProvider$1.getPriority(ManagedChannelProvider.java:49) ~[grpc-core-1.13.1.jar:1.13.1]
	at io.grpc.ManagedChannelProvider$1.getPriority(ManagedChannelProvider.java:41) ~[grpc-core-1.13.1.jar:1.13.1]
	at io.grpc.ServiceProviders$1.compare(ServiceProviders.java:78) ~[grpc-core-1.13.1.jar:1.13.1]
	at java.util.Collections$ReverseComparator2.compare(Collections.java:5178) ~[na:1.8.0_131]
	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:360) ~[na:1.8.0_131]
	at java.util.TimSort.sort(TimSort.java:220) ~[na:1.8.0_131]
	at java.util.Arrays.sort(Arrays.java:1512) ~[na:1.8.0_131]
	at java.util.ArrayList.sort(ArrayList.java:1454) ~[na:1.8.0_131]
	at java.util.Collections.sort(Collections.java:175) ~[na:1.8.0_131]

I then thought that the grpc-okhttp perhaps needed an upgrade, since it did not match the version of grpc-core, but upgrading resulted in another stacktrace:

Caused by: java.lang.AbstractMethodError: io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.getScheduledExecutorService()Ljava/util/concurrent/ScheduledExecutorService;
	at io.grpc.internal.CallCredentialsApplyingTransportFactory.getScheduledExecutorService(CallCredentialsApplyingTransportFactory.java:54) ~[grpc-core-1.13.1.jar:1.13.1]
	at io.grpc.internal.ManagedChannelImpl.<init>(ManagedChannelImpl.java:576) ~[grpc-core-1.13.1.jar:1.13.1]
	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:410) ~[grpc-core-1.13.1.jar:1.13.1]
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:206) ~[gax-grpc-1.29.0.jar:1.29.0]
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157) ~[gax-grpc-1.29.0.jar:1.29.0]
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149) ~[gax-grpc-1.29.0.jar:1.29.0]
	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151) ~[gax-1.29.0.jar:1.29.0]
	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:116) ~[gax-1.29.0.jar:1.29.0]
	at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:127) ~[google-cloud-logging-1.37.1.jar:1.37.1]
	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:64) ~[google-cloud-logging-1.37.1.jar:1.37.1]

The dependencies in build.sbt currently look like this:

libraryDependencies ++= Seq(
  "com.google.cloud" % "google-cloud-core" % "1.37.1",
  jdbc,
  cache,
  ws,
  evolutions,
  "mysql" % "mysql-connector-java" % "5.1.28",
  "com.google.cloud.sql" % "mysql-socket-factory" % "1.0.2",
  "com.roundeights" %% "hasher" % "1.2.0",
  "io.intercom" % "intercom-java" % "2.3.3",
  "com.mixpanel" % "mixpanel-java" % "1.4.2",
  "eu.inn" %% "fluentd-scala" % "0.1.13",
  "com.typesafe.play" %% "anorm" % "2.4.0",
  "com.google.firebase" % "firebase-admin" % "4.0.3",
  "org.specs2" %% "specs2-core" % "3.6.2" % "test",
  "us.raudi.pushraven" % "Pushraven" % "1.0.2",
  "com.google.cloud" % "google-cloud-speech" % "0.20.1-alpha",
  "com.google.auth" % "google-auth-library-oauth2-http" % "0.6.0",
  "com.google.cloud" % "google-cloud-logging" % "1.37.1",
  "com.google.guava" % "guava" % "25.1-jre",
  "com.github.rishabh9" %% "mdc-propagation-dispatcher" % "0.0.5",
  "com.github.nscala-time" %% "nscala-time" % "2.18.0",
  "com.google.cloud" % "google-cloud-datastore" % "1.14.0",
  "com.github.davidmoten" % "geo" % "0.7.1",
  "com.danielasfregola" %% "twitter4s" % "3.0",
  "com.google.cloud" % "google-cloud-pubsub" % "1.37.1"
)

libraryDependencies += specs2 % Test

Any idea what might be wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
snthibaudcommented, Aug 6, 2018

I see. So in this case, since excludeAll is applied to google-cloud-speech and google-cloud-datastore a failure would be expected in one of those if these libraries would be incompatible by a dependency version chosen by other libraries, right?

1reaction
mmziyadcommented, Aug 2, 2018

Try this:

  // Exclusion rules
  val exclusionRules = Seq(
    ExclusionRule("io.grpc", "grpc-okhttp"),
    ExclusionRule("io.grpc", "grpc-netty"),
    ExclusionRule( "io.grpc", "grpc-core")
  )

  libraryDependencies ++= Seq(
    "com.google.cloud" % "google-cloud-core" % "1.37.1",
    jdbc,
    cache,
    ws,
    evolutions,
    "mysql" % "mysql-connector-java" % "5.1.28",
    "com.google.cloud.sql" % "mysql-socket-factory" % "1.0.2" excludeAll(exclusionRules:_*), 
    "com.roundeights" %% "hasher" % "1.2.0",
    "io.intercom" % "intercom-java" % "2.3.3",
    "com.mixpanel" % "mixpanel-java" % "1.4.2",
    "eu.inn" %% "fluentd-scala" % "0.1.13",
    "com.typesafe.play" %% "anorm" % "2.4.0",
    "com.google.firebase" % "firebase-admin" % "4.0.3" excludeAll(exclusionRules:_*),
    "org.specs2" %% "specs2-core" % "3.6.2" % "test",
    "us.raudi.pushraven" % "Pushraven" % "1.0.2",
    "com.google.cloud" % "google-cloud-speech" % "0.20.1-alpha" excludeAll(exclusionRules:_*),
    "com.google.auth" % "google-auth-library-oauth2-http" % "0.6.0" excludeAll(exclusionRules:_*),
    "com.google.cloud" % "google-cloud-logging" % "1.37.1" excludeAll(exclusionRules:_*),
    "com.google.guava" % "guava" % "25.1-jre" excludeAll(exclusionRules:_*),
    "com.github.rishabh9" %% "mdc-propagation-dispatcher" % "0.0.5",
    "com.github.nscala-time" %% "nscala-time" % "2.18.0",
    "com.google.cloud" % "google-cloud-datastore" % "1.14.0" excludeAll(exclusionRules:_*),
    "com.github.davidmoten" % "geo" % "0.7.1",
    "com.danielasfregola" %% "twitter4s" % "3.0",
    "com.google.cloud" % "google-cloud-pubsub" % "1.37.1"
  )

  libraryDependencies += specs2 % Test

I have added exclusion rules to all google-cloud dependency. You may try to remove one by one to see which dependency is injecting the conflicting io.grpc.netty version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble-Shooting | grpc-spring-boot-starter - GitHub Pages
Caused by: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available at io.grpc.
Read more >
1 - Stack Overflow
java.lang.AbstractMethodError: io.netty.handler.codec.http.DefaultFullHttpRequest.touch(Ljava/lang/Object;)Lio/netty/util/ ...
Read more >
Google Groups
NoSuchMethodError :io.netty.handler.codec.http. ... I am using java 1.8 and trying to connect my java grpc-client to ruby grpc ... at java.util.concurrent.
Read more >
Panic! This is a bug! -- on macOS Mojave - Discuss Dgraph
Posted by wiradikusuma: I created a Java client that connects to Dgraph ... AbstractMethodError: io.grpc.netty.shaded.io.grpc.netty.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found