NoClassDefFoundError - 使用Akka的GenTraversableOnce $ class

时间:2017-09-20 05:09:34

标签: scala akka

使用Akka时出现以下错误。我怀疑这可能是因为不兼容的Akka版本,但我不知道使用哪一个。

build.sbt

name := "Example"

version := "1.0"

scalaVersion := "2.11.1"

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies += "com.typesafe.akka" % "akka-actor_2.10" % "2.2-M1"

错误

>sbt run
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading global plugins from C:\Users\Manu\.sbt\0.13\plugins
[info] Set current project to Example (in build file:/C:/Users/Manu/Documents/manu/programs/scala/from_book/)
[info] Running Upper
[error] (run-main-0) java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
        at akka.util.Collections$EmptyImmutableSeq$.<init>(Collections.scala:15)

1 个答案:

答案 0 :(得分:1)

_2.10中的前缀akka-actor_2.10表示您需要Scala 2.10的版本,该版本与您上面的scala版本(2.11)不匹配。

如果您想使用Scala 2.11,最新版本的Akka将是

libraryDependencies += "com.typesafe.akka" % "akka-actor_2.11" % "2.5.4"

您可以在此处查看所有版本:https://mvnrepository.com/artifact/com.typesafe.akka/akka-actor_2.11