gpt4 book ai didi

apache-flink - Apache Flink : Cannot find compatible factory for specified execution. 目标(=本地)

转载 作者:行者123 更新时间:2023-12-04 10:31:39 25 4
gpt4 key购买 nike

我决定尝试一下 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,

或在菊石repl:

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

关于apache-flink - Apache Flink : Cannot find compatible factory for specified execution. 目标(=本地),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60391499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com