gpt4 book ai didi

scala - java.lang.VerifyError 函数参数不兼容

转载 作者:行者123 更新时间:2023-12-01 08:03:58 25 4
gpt4 key购买 nike

我收到一个奇怪的错误 sbt run对于我编写的 Spray 示例应用程序,它编译得很好,我只在我的个人计算机上出现错误,因为它在另一台计算机上运行良好。

这是我认为的相关来源,它是来自 Spray sample code 的模板代码但我不认为这是原因。

package spray.examples

import akka.actor.{ActorSystem, Props}
import akka.io.IO
import spray.can.Http

object Boot extends App {

implicit val system = ActorSystem()

// the handler actor replies to incoming HttpRequests
val handler = system.actorOf(Props[DemoServiceActor], name = "handler")

IO(Http) ! Http.Bind(handler, interface = "localhost", port = 8080)
}

这是堆栈跟踪
Uncaught error from thread [default-akka.actor.default-dispatcher-3] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[default]
java.lang.VerifyError: (class: spray/can/server/HttpListener, method: <init> signature: (Lakka/actor/ActorRef;Lspray/can/Http$Bind;Lspray/can/HttpExt$Settings;)V) Incompatible argument to function
at spray.can.HttpManager$$anonfun$receive$1$$anonfun$applyOrElse$1.apply(HttpManager.scala:65)
at spray.can.HttpManager$$anonfun$receive$1$$anonfun$applyOrElse$1.apply(HttpManager.scala:65)
at akka.actor.CreatorFunctionConsumer.produce(Props.scala:369)
at akka.actor.Props.newActor(Props.scala:323)
at akka.actor.ActorCell.newActor(ActorCell.scala:534)
at akka.actor.ActorCell.create(ActorCell.scala:560)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:425)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:447)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:262)
at akka.dispatch.Mailbox.run(Mailbox.scala:218)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
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)

如评论中所示,这可能是 classpath问题,但我不知道如何调试。是否巧合,这发生在我从股票 Mac OS X Java 6 升级到 Java 7 之后,我在两台机器上都有 Java 7。任何见解将不胜感激。

如果这可能有帮助,这里是 classpathsbt console 转储, 编译和运行是一样的
List(Attributed(/Users/bob/projects/spray-file-upload/target/scala-2.10/classes), 
Attributed(/Users/bob/.sbt/0.12.4/boot/scala-2.10.2/lib/scala-library.jar),
Attributed(/Users/bob/.ivy2/cache/com.typesafe.akka/akka-actor_2.10/jars/akka-actor_2.10-
2.2.0.jar), Attributed(/Users/bob/.ivy2/cache/com.typesafe/config/bundles/config-1.0.2.jar),
Attributed(/Users/bob/.ivy2/cache/io.spray/spray-json_2.10/jars/spray-json_2.10-1.2.5.jar),
Attributed(/Users/bob/.ivy2/cache/org.parboiled/parboiled-scala_2.10/bundles/parboiled-
scala_2.10-1.1.5.jar), Attributed(/Users/bob/.ivy2/cache/org.parboiled/parboiled-
core/bundles/parboiled-core-1.1.5.jar), Attributed(/Users/bob/.ivy2/cache/io.spray/spray-
can/jars/spray-can-1.2-M8.jar), Attributed(/Users/bob/.ivy2/cache/io.spray/spray-
io/jars/spray-io-1.2-M8.jar), Attributed(/Users/bob/.ivy2/cache/io.spray/spray-
util/jars/spray-util-1.2-M8.jar), Attributed(/Users/bob/.ivy2/cache/io.spray/spray-
http/jars/spray-http-1.2-M8.jar), Attributed(/Users/bob/.ivy2/cache/io.spray/spray-
httpx/jars/spray-httpx-1.2-M8.jar),
Attributed(/Users/bob/.ivy2/cache/org.jvnet.mimepull/mimepull/jars/mimepull-1.9.2.jar),
Attributed(/Users/bob/.ivy2/cache/io.spray/spray-routing/jars/spray-routing-1.2-M8.jar),
Attributed(/Users/bob/.ivy2/cache/com.chuusai/shapeless_2.10/jars/shapeless_2.10-1.2.4.jar))

如果有人想尝试使用 Java 7 进行全新编译,然后 sbt run ,随时从 repo 获取它.

最佳答案

不幸的是,1.2-M8 与 Akka 2.2.0 final 不兼容。要么使用 Akka 2.2.0-RC1,要么升级到更新的每晚生成的 Spray 1.2。

更新:另外,现在最终版本已经发布,所以你可以使用 1.2.0 和最新的 Akka 2.2.3。

关于scala - java.lang.VerifyError 函数参数不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18117710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com