Closed chenhj closed 7 years ago
Can you try removing "com.twitter"%"finagle-http_2.11"%"6.35.0"
from your build file?
Thank @vkostyukov reply, I tried, and the same problem The details of the jar package are as follows
> dependencyList
[info] aopalliance:aopalliance:1.0
[info] ch.qos.logback:logback-classic:1.1.6
[info] ch.qos.logback:logback-core:1.1.6
[info] com.fasterxml.jackson.core:jackson-annotations:2.8.4
[info] com.fasterxml.jackson.core:jackson-core:2.8.4
[info] com.fasterxml.jackson.core:jackson-databind:2.8.4
[info] com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.4
[info] com.fasterxml.jackson.module:jackson-module-paranamer:2.8.4
[info] com.fasterxml.jackson.module:jackson-module-scala_2.11:2.8.4
[info] com.github.ben-manes.caffeine:caffeine:2.3.4
[info] com.github.nscala-time:nscala-time_2.11:1.6.0
[info] com.github.spullara.mustache.java:compiler:0.8.18
[info] com.google.code.findbugs:jsr305:2.0.1
[info] com.google.guava:guava:19.0
[info] com.google.inject:guice:4.1.0
[info] com.google.inject.extensions:guice-assistedinject:4.0
[info] com.google.inject.extensions:guice-multibindings:4.0
[info] com.iheart:ficus_2.11:1.2.3
[info] com.thoughtworks.paranamer:paranamer:2.8
[info] com.twitter:finagle-base-http_2.11:6.45.0
[info] com.twitter:finagle-core_2.11:6.45.0
[info] com.twitter:finagle-http2_2.11:6.45.0
[info] com.twitter:finagle-http_2.11:6.45.0
[info] com.twitter:finagle-mysql_2.11:6.45.0
[info] com.twitter:finagle-netty4-http_2.11:6.45.0
[info] com.twitter:finagle-netty4_2.11:6.45.0
[info] com.twitter:finagle-stats_2.11:6.45.0
[info] com.twitter:finagle-thrift_2.11:6.45.0
[info] com.twitter:finagle-toggle_2.11:6.45.0
[info] com.twitter:finagle-tunable_2.11:6.45.0
[info] com.twitter:finagle-zipkin-core_2.11:6.45.0
[info] com.twitter:finagle-zipkin_2.11:6.45.0
[info] com.twitter:jsr166e:1.1.0
[info] com.twitter:libthrift:0.5.0-7
[info] com.twitter:scrooge-core_2.11:4.18.0
[info] com.twitter:twitter-server_2.11:1.30.0
[info] com.twitter:util-app_2.11:6.45.0
[info] com.twitter:util-cache_2.11:6.45.0
[info] com.twitter:util-codec_2.11:6.45.0
[info] com.twitter:util-collection_2.11:6.45.0
[info] com.twitter:util-core_2.11:6.45.0
[info] com.twitter:util-events_2.11:6.45.0
[info] com.twitter:util-function_2.11:6.45.0
[info] com.twitter:util-hashing_2.11:6.45.0
[info] com.twitter:util-jvm_2.11:6.45.0
[info] com.twitter:util-lint_2.11:6.45.0
[info] com.twitter:util-logging_2.11:6.45.0
[info] com.twitter:util-registry_2.11:6.45.0
[info] com.twitter:util-security_2.11:6.45.0
[info] com.twitter:util-stats_2.11:6.45.0
[info] com.twitter:util-tunable_2.11:6.45.0
[info] com.twitter.common:base:0.0.116
[info] com.twitter.common:collections:0.0.111
[info] com.twitter.common:metrics:0.0.39
[info] com.twitter.common:quantity:0.0.100
[info] com.twitter.common:stats-util:0.0.60
[info] com.twitter.common:util-executor-service-shutdown:0.0.68
[info] com.twitter.common:util-system-mocks:0.0.105
[info] com.twitter.finatra:finatra-http_2.11:2.1.6
[info] com.twitter.finatra:finatra-jackson_2.11:2.1.6
[info] com.twitter.finatra:finatra-scalap-compiler-deps_2.11:2.0.0
[info] com.twitter.finatra:finatra-slf4j_2.11:2.1.6
[info] com.twitter.finatra:finatra-utils_2.11:2.1.6
[info] com.twitter.inject:inject-app_2.11:2.1.6
[info] com.twitter.inject:inject-core_2.11:2.1.6
[info] com.twitter.inject:inject-modules_2.11:2.1.6
[info] com.twitter.inject:inject-request-scope_2.11:2.1.6
[info] com.twitter.inject:inject-server_2.11:2.1.6
[info] com.twitter.inject:inject-utils_2.11:2.1.6
[info] com.typesafe:config:1.3.1
[info] com.typesafe.scala-logging:scala-logging_2.11:3.5.0
[info] commons-codec:commons-codec:1.3
[info] commons-fileupload:commons-fileupload:1.3.1
[info] commons-io:commons-io:2.4
[info] commons-lang:commons-lang:2.6
[info] commons-logging:commons-logging:1.1.1
[info] default:finatra-demo_2.11:1.0
[info] io.getquill:quill-core_2.11:1.3.0
[info] io.getquill:quill-finagle-mysql_2.11:1.3.0
[info] io.getquill:quill-sql_2.11:1.3.0
[info] io.netty:netty:3.10.1.Final
[info] io.netty:netty-buffer:4.1.10.Final
[info] io.netty:netty-codec:4.1.10.Final
[info] io.netty:netty-codec-http:4.1.10.Final
[info] io.netty:netty-codec-http2:4.1.10.Final
[info] io.netty:netty-codec-socks:4.1.10.Final
[info] io.netty:netty-common:4.1.10.Final
[info] io.netty:netty-handler:4.1.10.Final
[info] io.netty:netty-handler-proxy:4.1.10.Final
[info] io.netty:netty-resolver:4.1.10.Final
[info] io.netty:netty-transport:4.1.10.Final
[info] io.netty:netty-transport-native-epoll:4.1.10.Final
[info] javax.inject:javax.inject:1
[info] javax.servlet:servlet-api:2.5
[info] joda-time:joda-time:2.9.3
[info] junit:junit:4.4
[info] log4j:log4j:1.2.17
[info] net.codingwell:scala-guice_2.11:4.0.0
[info] org.apache.httpcomponents:httpclient:4.0.1
[info] org.apache.httpcomponents:httpcore:4.0.1
[info] org.apache.thrift:libthrift:0.6.1
[info] org.clapper:grizzled-slf4j_2.11:1.0.2
[info] org.joda:joda-convert:1.8
[info] org.scala-lang:scala-reflect:2.11.11
[info] org.scala-lang:scalap:2.11.11
[info] org.scala-lang.modules:scala-async_2.11:0.9.5
[info] org.scala-lang.modules:scala-parser-combinators_2.11:1.0.4
[info] org.scalamacros:resetallattrs_2.11:1.0.0
[info] org.slf4j:jcl-over-slf4j:1.7.7
[info] org.slf4j:jul-to-slf4j:1.7.7
[info] org.slf4j:slf4j-api:1.7.21
[info] org.slf4j:slf4j-log4j12:1.7.16
reStart fail
finatra-demo[ERROR] I 0726 02:10:59.201 THREAD1: Finagle version 6.45.0 (rev=fadc80cdd804f2885ebc213964542d5568a4f485) built at 20170609-103047
finatra-demo[ERROR] com.google.inject.ProvisionException: Unable to provision, see the following errors:
finatra-demo[ERROR]
finatra-demo[ERROR] 1) Error injecting constructor, java.lang.NoClassDefFoundError: com/twitter/finagle/http/Method$Get$
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleController.<init>(ExampleController.scala:12)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleController.class(ExampleController.scala:12)
finatra-demo[ERROR] while locating com.twiiter.demo.controller.ExampleController
finatra-demo[ERROR]
finatra-demo[ERROR] 1 error
finatra-demo[ERROR] at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1028)
finatra-demo[ERROR] at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1050)
finatra-demo[ERROR] at com.twitter.inject.Injector.instance(Injector.scala:12)
finatra-demo[ERROR] at com.twitter.finatra.http.routing.HttpRouter.add(HttpRouter.scala:121)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer$.configureHttp(ExampleController.scala:22)
finatra-demo[ERROR] at com.twitter.finatra.http.HttpServer$class.postStartup(HttpServer.scala:34)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer$.postStartup(ExampleController.scala:18)
finatra-demo[ERROR] at com.twitter.inject.app.App$class.main(App.scala:44)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer$.com$twitter$inject$server$TwitterServer$$super$main(ExampleController.scala:18)
finatra-demo[ERROR] at com.twitter.inject.server.TwitterServer$class.main(TwitterServer.scala:72)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer$.main(ExampleController.scala:18)
finatra-demo[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
finatra-demo[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
finatra-demo[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
finatra-demo[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
finatra-demo[ERROR] at com.twitter.app.App$$anonfun$nonExitingMain$3.apply(App.scala:225)
finatra-demo[ERROR] at com.twitter.app.App$$anonfun$nonExitingMain$3.apply(App.scala:224)
finatra-demo[ERROR] at scala.Option.foreach(Option.scala:257)
finatra-demo[ERROR] at com.twitter.app.App$class.nonExitingMain(App.scala:224)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer$.nonExitingMain(ExampleController.scala:18)
finatra-demo[ERROR] at com.twitter.app.App$class.main(App.scala:190)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer$.main(ExampleController.scala:18)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleServer.main(ExampleController.scala)
finatra-demo[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
finatra-demo[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
finatra-demo[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
finatra-demo[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
finatra-demo[ERROR] at scala.reflect.internal.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:70)
finatra-demo[ERROR] at scala.reflect.internal.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
finatra-demo[ERROR] at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:101)
finatra-demo[ERROR] at scala.reflect.internal.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:70)
finatra-demo[ERROR] at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
finatra-demo[ERROR] at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:22)
finatra-demo[ERROR] at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:39)
finatra-demo[ERROR] at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:29)
finatra-demo[ERROR] at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:39)
finatra-demo[ERROR] at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:65)
finatra-demo[ERROR] at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
finatra-demo[ERROR] at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
finatra-demo[ERROR] at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
finatra-demo[ERROR] at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
finatra-demo[ERROR] Caused by: java.lang.NoClassDefFoundError: com/twitter/finagle/http/Method$Get$
finatra-demo[ERROR] at com.twitter.finatra.http.Controller.<init>(Controller.scala:7)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleController.<init>(ExampleController.scala:12)
finatra-demo[ERROR] at com.twiiter.demo.controller.ExampleController$$FastClassByGuice$$f5bbf722.newInstance(<generated>)
finatra-demo[ERROR] at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
finatra-demo[ERROR] at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
finatra-demo[ERROR] at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
finatra-demo[ERROR] at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268)
finatra-demo[ERROR] at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
finatra-demo[ERROR] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
finatra-demo[ERROR] at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
finatra-demo[ERROR] at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)
finatra-demo[ERROR] at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
finatra-demo[ERROR] at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019)
finatra-demo[ERROR] at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
finatra-demo[ERROR] at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015)
finatra-demo[ERROR] ... 40 more
finatra-demo[ERROR] Caused by: java.lang.ClassNotFoundException: com.twitter.finagle.http.Method$Get$
finatra-demo[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
finatra-demo[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
finatra-demo[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
finatra-demo[ERROR] ... 55 more
finatra-demo[ERROR] Exception thrown in main on startup
finatra-demo ... finished with exit code 1
>
Hey @chenhj ! I see you're missing a comma after the quill import:
"com.twitter" % "jsr166e" % "1.1.0", "io.getquill" % "quill-finagle-mysql_2.11" % "1.3.0" "com.twitter" %% "finagle-mysql" % "6.45.0",
@jcrossley Thank you for your reply. I am missing a comma on the information above. But this is not the real cause of the problem. My project can be compiled normally, but it has been started and an error has occurred,
@chenhj NoClassDefFound means that there's a class that your code needs, but it can't find it. This typically happens when your project transitively depends on more than one version of a library. For example, imagine that you're building project A, which depends on lib X, and project B, which also depends on lib X. However, project B was built against an older version of lib X, which used to have a class, but which it no longer exports.
A => B => X (version 1) A => X (version 2)
Then when it runs, A makes a call into B, which tries to make a call into X, but because the project now uses the newer version instead of the older version, it can't find the class it needs.
I would encourage you to use sbt-dependency-graph to see which versions of finagle you're depending on transitively, and ensure that every library you use uses the same version of finagle-http.
This isn't a finagle-specific problem, and you may find it with other libraries like guava or scalactic in the future. I'm going to close this ticket, but please feel free to reach out if you have other concerns.
ExampleController.scala
reStart error