使用idea开发flink报错,就是普通的读取文本内容,进行单词计数。scala版本是2.11.12,flink是1.8.1
报错信息如下:
Exception in thread “main” java.lang.NoSuchMethodError: akka.actor.ActorSystemImpl.(Ljava/lang/String;Lcom/typesafe/config/Config;Ljava/lang/ClassLoader;Lscala/Option;Lscala/Option;Lakka/actor/setup/ActorSystemSetup;)V
at akka.actor.RobustActorSystem.(RobustActorSystem.scala:41)
at akka.actor.RobustActorSystem.internalApply(RobustActorSystem.scala:89) at akka.actor.RobustActorSystem.internalApply(RobustActorSystem.scala:89)atakka.actor.RobustActorSystem.apply(RobustActorSystem.scala:70)
at akka.actor.RobustActorSystem.create(RobustActorSystem.scala:55) at org.apache.flink.runtime.akka.AkkaUtils.create(RobustActorSystem.scala:55)atorg.apache.flink.runtime.akka.AkkaUtils.createActorSystem(AkkaUtils.scala:125)
…………
at org.apache.flink.api.java.LocalEnvironment.execute(LocalEnvironment.java:91)
at org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:817)
at org.apache.flink.api.java.DataSet.collect(DataSet.java:413)
at org.apache.flink.api.java.DataSet.print(DataSet.java:1652)
at org.apache.flink.api.scala.DataSet.print(DataSet.scala:1864)
at com.jian.flink.batch.BatchWordCnt$.main(BatchWordCnt.scala:19)
at com.jian.flink.batch.BatchWordCnt.main(BatchWordCnt.scala)
Process finished with exit code 1

==================================

解决办法:

从网上也查了一些资料,说是scala版本不一致导致的错误。

项目中的pom文件引用的scala都是2.11的,本地使用的也是scala2.11.12版的,看着大版本是一样,但是经过多次调试还是无法解决此问题。

1,window的命令行查看scala本地版本

C:\Users\jianxp>scala -version
Scala code runner version 2.11.12 -- Copyright 2002-2017, LAMP/EPFL

2,idea的项目配置,修改两处
使用idea开发flink报错_第1张图片

使用idea开发flink报错_第2张图片

3,再次运行代码,无错误。