通常版本不匹配报告如下问题:


Exception in thread "main" java.lang.NoSuchMethodError:
scala.Product.$init$(Lscala/Product;)V at
akka.util.Timeout.<init>(Timeout.scala:13) at
akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:329) at
akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:667) at
akka.actor.ActorSystem$.apply(ActorSystem.scala:246) at
akka.actor.ActorSystem$.apply(ActorSystem.scala:289) at
akka.actor.ActorSystem$.apply(ActorSystem.scala:234) at
com.akka.test.Hello1$.delayedEndpoint$com$akka$test$Hello1$1(Hello1.scala:12)
at com.akka.test.Hello1$delayedInit$body.apply(Hello1.scala:10) at
scala.Function0$class.apply$mcV$sp(Function0.scala:34) at
scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) at
scala.App$$anonfun$main$1.apply(App.scala:76) at
scala.App$$anonfun$main$1.apply(App.scala:76) at
scala.collection.immutable.List.foreach(List.scala:392) at
scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76) at
com.akka.test.Hello1$.main(Hello1.scala:10) at
com.akka.test.Hello1.main(Hello1.scala
解决办法:

1、查看本地scala版本

Scala code runner version 2.11.12 -- Copyright 2002-2017, LAMP/EPFL


2、查看IDEA编译的版本



3、查看导入scala依赖包的版本
<dependency> <groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.12</artifactId> <version>2.5.13</version> </dependency>
问题就出在这:将2.12 改为2.11 问题即可解决!