错误提示如下:
Connected to the target VM, address: '127.0.0.1:51983', transport: 'socket' Exception in thread "main" java.lang.NoClassDefFoundError: scala/Product$class at akka.util.Timeout.<init>(Timeout.scala:13) at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:170) at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:540) at akka.actor.ActorSystem$.apply(ActorSystem.scala:141) at akka.actor.ActorSystem$.apply(ActorSystem.scala:108) at com.m24.learn.akka.SysHelloActor$.start(AkkaDemo.scala:20) at com.m24.learn.akka.AkkaDemo$.main(AkkaDemo.scala:31) at com.m24.learn.akka.AkkaDemo.main(AkkaDemo.scala) Caused by: java.lang.ClassNotFoundException: scala.Product$class at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 8 more Disconnected from the target VM, address: '127.0.0.1:51983', transport: 'socket' Process finished with exit code 1
原因:
akka需要和scala版本相对应
dependencies { compile group: 'org.scala-lang', name: 'scala-library', version: '2.12.6' compile "org.scala-lang:scala-compiler:2.12.6" compile "org.scala-lang:scala-reflect:2.12.6" compile "com.typesafe.akka:akka-actor_2.12:2.5.17" testCompile "junit:junit:4.11" }