我正在尝试运行 Spray 文档中的“Minimal Example”: Spray 1.2-RC2 > Routing
我正在使用 scala 2.10.3,这是我在 Dependencies.scala 文件中描述的配置的一部分:
val sprayVersion = "1.2-RC2"
val sprayCan = "io.spray" % "spray-can" % sprayVersion
val sprayRouting = "io.spray" % "spray-routing" % sprayVersion
val sprayJson = "io.spray" %% "spray-json" % "1.2.5"
val akkaVersion = "2.2.3"
val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion
这是我的简单代码,如示例:
import spray.routing.SimpleRoutingApp
object Main extends App with SimpleRoutingApp {
startServer(interface = "localhost", port = 8080) {
path("hello") {
get {
complete {
<h1>Say hello to spray</h1>
}
}
}
}
}
在编译时我收到以下错误
bad symbolic reference. A signature in Http.class refers to term actor
in package akka which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling Http.class.
startServer(interface = "localhost", port = 8080) {
^
我只是不知道我在做什么错。
编辑:我认为错误是由方法的返回 startServer 中使用的 Http.Bound 引起的:
IO(Http).ask(Http.Bind(serviceActor, interface, port, backlog, options, settings)).mapTo[Http.Bound]
特别是我认为它在 Http.scala 中导入akka.io.Tcp会给你带来问题。在Akka 文档中,我读到更多 IO 从 akka 2.2.0 被标记为“实验性”
我要疯了