0
火花提出し、このエラーを使用する場合は、必ず起こる:ERROR SPARKを使用して:java.lang.NoClassDefFoundErrorが:ディスパッチ/ HTTP
ERROR Executor: Exception in task 0.0 in stage 137.0 (TID 35)
java.lang.NoClassDefFoundError: dispatch/Http$
私はlibに(私はスカラ座を使用しています)をインポート持っているが:
をコードのimport dispatch._, Defaults._
パート:
def publishToNsq(data: String) = {
val topic = "post_similar_items_to_elasticsearch"
val host = "192.168.100.160:4151"
def myRequest = url(s"$host/pub?topic=$topic")
def myRequestAsJson = myRequest.setContentType("application/json", "UTF-8")
def myPostWithBody = myRequestAsJson << data
val response = Http(myPostWithBody OK as.String)
println(response)
}
これは私のbuild.sbtの一部です:
scalaVersion := "2.10.5"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.6.1"
libraryDependencies += "org.apache.spark" %% "spark-mllib" % "1.6.1"
libraryDependencies += "org.json4s" %% "json4s-native" % "3.4.0"
libraryDependencies += "org.json4s" %% "json4s-jackson" % "3.4.0"
libraryDependencies += "org.scalaj" %% "scalaj-http" % "1.1.4"
libraryDependencies += "net.databinder.dispatch" %% "dispatch-core" % "0.11.2"
resolvers += Resolver.mavenLocal
のように構成した場合、依存関係は瓶で、それが解決されるだろうではありません。 – eliasah