0

我有一个多模块 sbt 项目,它使用 spray-can 作为其依赖项之一。这是我的 sbt 中的内容:

"com.typesafe" % "config" % "1.2.0",
"io.spray" % "spray-routing" % 1.2.0,
"io.spray" % "spray-can" % 1.2.0,
"com.typesafe.akka" %% "akka-actor" % "2.3.11",

我使用 scala 版本 2.11.6 和 Java 8。当我运行我的项目时,我收到以下错误:

Uncaught error from thread [my-actor-system-akka.actor.default-dispatcher-5] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[my-actor-system]
java.lang.NoClassDefFoundError: spray/can/HttpManager$$anonfun$receive$1
    at spray.can.HttpManager.receive(HttpManager.scala:42)
    at akka.actor.ActorCell.newActor(ActorCell.scala:558)
    at akka.actor.ActorCell.create(ActorCell.scala:578)
    at akka.actor.dungeon.FaultHandling$class.finishCreate(FaultHandling.scala:136)
    at akka.actor.dungeon.FaultHandling$class.faultCreate(FaultHandling.scala:130)
    at akka.actor.ActorCell.faultCreate(ActorCell.scala:369)
    at akka.actor.dungeon.FaultHandling$class.faultRecreate(FaultHandling.scala:59)
    at akka.actor.ActorCell.faultRecreate(ActorCell.scala:369)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:459)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
    at akka.dispatch.Mailbox.run(Mailbox.scala:219)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
    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)
16:04:22.382 [my-actor-system-akka.actor.default-dispatcher-3] ERROR akka.actor.ActorSystemImpl - Uncaught error from thread [my-actor-system-akka.actor.default-dispatcher-5] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.NoClassDefFoundError: spray/can/HttpManager$$anonfun$receive$1
    at spray.can.HttpManager.receive(HttpManager.scala:42) ~[spray-can-1.2.0.jar:na]
    at akka.actor.ActorCell.newActor(ActorCell.scala:558) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.create(ActorCell.scala:578) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.dungeon.FaultHandling$class.finishCreate(FaultHandling.scala:136) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.dungeon.FaultHandling$class.faultCreate(FaultHandling.scala:130) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.faultCreate(ActorCell.scala:369) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.dungeon.FaultHandling$class.faultRecreate(FaultHandling.scala:59) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.faultRecreate(ActorCell.scala:369) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:459) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:219) ~[akka-actor_2.11-2.3.11.jar:na]
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [akka-actor_2.11-2.3.11.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.6.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.6.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.6.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.6.jar:na]
Uncaught error from thread [inland24-actor-system-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for
4

1 回答 1

1

这有助于解决我的问题:

"io.spray" %% "spray-routing" % sprayVersion,
"io.spray" %% "spray-can" % sprayVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,

scalaVersion := "2.11.6"

val sprayVersion = "1.3.3"
val akkaVersion = "2.3.9"
于 2015-11-07T15:24:20.050 回答