喷涂路由模板不起作用

时间:2015-04-26 10:20:10

标签: scala spray

我尝试在https://github.com/spray/spray-template处运行喷涂模板。

我在第5步(启动应用程序)时收到错误

[ERROR] [04/26/2015 12:49:18.613] [on-spray-can-akka.actor.default-dispatcher-4] [akka://on-spray-can/user/IO-HTTP/listener-0] 762
akka.actor.ActorInitializationException: exception during creation
    at akka.actor.ActorInitializationException$.apply(Actor.scala:164)
    at akka.actor.ActorCell.create(ActorCell.scala:596)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:279)
    at akka.dispatch.Mailbox.run(Mailbox.scala:220)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 762
    at spray.can.parsing.HttpHeaderParser.insert(HttpHeaderParser.scala:231)
    at spray.can.parsing.HttpHeaderParser$.insertInGoodOrder$1(HttpHeaderParser.scala:422)
    at spray.can.parsing.HttpHeaderParser$.apply(HttpHeaderParser.scala:429)
    at spray.can.parsing.HttpRequestPartParser$.$lessinit$greater$default$3(HttpRequestPartParser.scala:28)
    at spray.can.server.RequestParsing$.apply(RequestParsing.scala:36)
    at spray.can.server.HttpServerConnection$.pipelineStage(HttpServerConnection.scala:217)
    at spray.can.server.HttpListener.<init>(HttpListener.scala:36)
    at spray.can.HttpManager.newHttpListener(HttpManager.scala:84)
    at spray.can.HttpManager$$anonfun$receive$1$$anonfun$applyOrElse$1.apply(HttpManager.scala:76)
    at spray.can.HttpManager$$anonfun$receive$1$$anonfun$applyOrElse$1.apply(HttpManager.scala:76)
    at akka.actor.TypedCreatorFunctionConsumer.produce(Props.scala:343)
    at akka.actor.Props.newActor(Props.scala:252)
    at akka.actor.ActorCell.newActor(ActorCell.scala:552)
    at akka.actor.ActorCell.create(ActorCell.scala:578)
    ... 9 more

Java版

java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

1 个答案:

答案 0 :(得分:0)

您遇到的问题是由操作系统的语言引起的。

您应该将这两行添加到build.sbt

fork in run := true

javaOptions in run ++= Seq("-Duser.language=en", "-Duser.country=US", "-Dfile.encoding=UTF-8")

添加后,问题就解决了。