scala 版本不匹配的问题

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

Exception in thread "main" java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
	at akka.util.Timeout.(Timeout.scala:13)
	at akka.actor.ActorSystem$Settings.(ActorSystem.scala:329)
	at akka.actor.ActorSystemImpl.(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编译的版本

scala 版本不匹配的问题_第1张图片

3、查看导入scala依赖包的版本

 
      com.typesafe.akka
      akka-actor_2.12
      2.5.13
    

问题就出在这:将2.12 改为2.11 问题即可解决!




你可能感兴趣的:(采坑记录)