我的要求是使用spray从请求uri创建其余的json。我正在使用requestUri
指令来获取基本URL。当我通过IDE运行它或通过我的系统本地spark-submit时,我得到了正确的输出。但是,当我在群集上完成spark-submit
时,我没有使用requestUri
指令获取基本URL。我得到的网址是部分的。因此预期的输出也不合适。
获取网址的代码是
requestUri {
uri =>
val reqUri = s"$uri"//uri.toString()
complete {
println ("URI " + reqUri)
}
}
build.sbt看起来像这样
scalaVersion := "2.10.5"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.4.0"
resolvers ++= Seq(
"Akka Repository" at "http://repo.akka.io/releases/")
resolvers ++= Seq("Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
"Spray Repository" at "http://repo.spray.io")
libraryDependencies +=
"com.typesafe.akka" %% "akka-actor" % "2.3.0"
libraryDependencies ++= {
val sprayVersion = "1.3.1"
Seq(
"io.spray" %% "spray-can" % sprayVersion,
"io.spray" %% "spray-routing" % sprayVersion,
"io.spray" %% "spray-json" % sprayVersion
)
}
请告诉我如何解决此问题。您的所有建议都很有价值。提前谢谢。