java.lang.NoClassDefFoundError: Could not initialize class com.twitter.finagle.Init$

1k views Asked by At

I've project with dependency to finagle 7.1.0 and related libraries with Scala version as 2.11.11

When I upgraded the scala version to 2.12.6 and finagle version as 17.12.0 I'm getting below error.

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.twitter.finagle.Init$
    at com.twitter.finagle.client.StackClient$.endpointStack(StackClient.scala:54)
    at com.twitter.finagle.client.StackClient$.newStack(StackClient.scala:220)
    at com.twitter.finagle.builder.ClientConfig$NilClient$.apply$default$1(ClientBuilder.scala:74)
    at com.twitter.finagle.builder.ClientConfig$.nilClient(ClientBuilder.scala:91)
    at com.twitter.finagle.builder.ClientBuilder.<init>(ClientBuilder.scala:248)
    at com.twitter.finagle.builder.ClientBuilder$.apply(ClientBuilder.scala:46)
    at com.twitter.finagle.builder.ClientBuilder$.get(ClientBuilder.scala:52)
    at com.twitter.finagle.builder.ClientBuilder.get(ClientBuilder.scala)

Below is the dependency graph for finagle related jars -

[INFO] +- com.twitter:finagle-core_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:finagle-toggle_2.12:jar:17.12.0:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.8:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-scala_2.12:jar:2.8.8:compile
[INFO] |  |     \- com.fasterxml.jackson.module:jackson-module-paranamer:jar:2.8.8:compile
[INFO] |  +- com.twitter:finagle-init_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-app_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-cache_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-codec_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-core_2.12:jar:17.12.0:compile
[INFO] |  |  +- com.twitter:util-function_2.12:jar:17.12.0:compile
[INFO] |  |  +- org.scala-lang:scala-reflect:jar:2.12.6:compile
[INFO] |  |  \- org.scala-lang.modules:scala-parser-combinators_2.12:jar:1.0.4:compile
[INFO] |  +- com.twitter:util-hashing_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-jvm_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-lint_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-logging_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-registry_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-security_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-stats_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:util-tunable_2.12:jar:17.12.0:compile
[INFO] |  +- com.github.ben-manes.caffeine:caffeine:jar:2.3.4:compile
[INFO] |  \- com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO] +- org.scala-lang.modules:scala-java8-compat_2.12:jar:0.9.0:compile
[INFO] +- com.twitter:finagle-http_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:finagle-base-http_2.12:jar:17.12.0:compile
[INFO] |  |  \- com.twitter:finagle-netty3_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:finagle-netty3-http_2.12:jar:17.12.0:compile
[INFO] |  +- com.twitter:finagle-netty4-http_2.12:jar:17.12.0:compile
[INFO] |  |  +- com.twitter:finagle-netty4_2.12:jar:17.12.0:compile
[INFO] |  |  \- io.netty:netty-codec-http:jar:4.1.16.Final:compile
[INFO] |  |     \- io.netty:netty-codec:jar:4.1.16.Final:compile
[INFO] |  +- com.twitter:finagle-http2_2.12:jar:17.12.0:compile
[INFO] |  |  +- io.netty:netty-codec-http2:jar:4.1.16.Final:compile
[INFO] |  |  +- io.netty:netty-handler:jar:4.1.16.Final:compile
[INFO] |  |  |  \- io.netty:netty-buffer:jar:4.1.16.Final:compile
[INFO] |  |  +- io.netty:netty-transport:jar:4.1.16.Final:compile
[INFO] |  |  |  \- io.netty:netty-resolver:jar:4.1.16.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.16.Final:compile
[INFO] |  |  |  \- io.netty:netty-common:jar:4.1.16.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-unix-common:jar:4.1.16.Final:compile
[INFO] |  |  \- io.netty:netty-handler-proxy:jar:4.1.16.Final:compile
[INFO] |  |     \- io.netty:netty-codec-socks:jar:4.1.16.Final:compile
[INFO] |  \- com.twitter:util-collection_2.12:jar:17.12.0:compile

I do see similar issue when upgrading finagle version here but in my case util dependencies are valid.

Any Idea how to resolve this issue?

0

There are 0 answers