Apache Flink:找不到指定执行的兼容工厂.target(=local)



我决定尝试一下apache-flink。我决定使用scala控制台(或者更准确地说http://ammonite.io/)从csv文件中读取一些内容并在本地打印。。。只是为了调试最终的实验。

import $ivy.`org.apache.flink:flink-csv:1.10.0`
import $ivy.`org.apache.flink::flink-scala:1.10.0`
import org.apache.flink.api.scala._
import org.apache.flink.api.scala.extensions._
val env = ExecutionEnvironment.createLocalEnvironment()
val lines = env.readCsvFile[(String, String, String)]("/home/slovic/Dokumenty/test.csv")
lines.collect()
//java.lang.NullPointerException: Cannot find compatible factory for specified execution.target (=local)
//org.apache.flink.util.Preconditions.checkNotNull(Preconditions.java:104)
//org.apache.flink.api.java.ExecutionEnvironment.executeAsync(ExecutionEnvironment.java:937)
//org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:860)
//org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:844)
//org.apache.flink.api.scala.ExecutionEnvironment.execute(ExecutionEnvironment.scala:495)
//org.apache.flink.api.scala.DataSet.collect(DataSet.scala:739)
//ammonite.$sess.cmd24$.<init>(cmd24.sc:1)
//ammonite.$sess.cmd24$.<clinit>(cmd24.sc)

我需要做些什么才能在本地运行此代码?(用scala 2.11和2.12测试(

编辑:Piyush_Rana解决我们需要额外的导入:

import $ivy.`org.apache.flink::flink-streaming-scala:1.10.0`  //Piyush_Rana's advice. !!!FIX!!!

我也得到了同样的错误,并发现它缺少一个依赖项-

val flinkVersion = "1.10.0"
"org.apache.flink" %% "flink-streaming-scala" % flinkVersion,

或在菊石回复中:

import $ivy.`org.apache.flink::flink-streaming-scala:1.10.0`

您没有执行flink程序。

尝试在末尾添加execute命令。

env.execute("unique name")

相关内容

  • 没有找到相关文章

最新更新