Not getting the proper base url using requestUri on server machine using spark-submit

229 Views Asked by At

My requirement is creating the rest json from the request uri using spray. I am using requestUri directive to get the base URL. When I run it through IDE or through spark-submit locally on my system, I got the proper output. But when I have done spark-submit on the cluster, I am not getting the base url using requestUri directive.The url, I am getting is partial. Because of which the expected output is also not proper.

The code to get the url is

requestUri {
      uri =>
      val reqUri = s"$uri"//uri.toString()
        complete {
        println ("URI " + reqUri)
    }
}

build.sbt looks like this

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

  )
}

Please let me know how I can I fix this issue.All your suggestions are valuable. Thanks in advance.

0

There are 0 best solutions below