【问题标题】:object streaming is not a member of package org.apache.flink.test对象流不是包 org.apache.flink.test 的成员
【发布时间】:2019-03-07 14:08:10
【问题描述】:

我从github上git clone flink代码,用Intellij Idea打开,我在IJ和代码里都没有做任何配置(我已经安装了IJ scala插件和scala sdk),我直接去运行Intellij Idea中的以下两个示例

我能够成功运行批处理模式字数统计示例(代码是类org.apache.flink.examples.scala.wordcount.WordCount in flink-examples-batch_2.11 模块)。

但是当我尝试运行流式字数示例时(代码是类org.apache.flink.streaming.scala.examples.wordcount.WordCount in flink-examples-streaming_2.11 模块),我得到了很多编译错误:

Error:(30, 30) object streaming is not a member of package org.apache.flink.test
import org.apache.flink.test.streaming.runtime.util.TestListResultSink
Error:(46, 36) not found: type TestListResultSink
    val sideOutputResultSink = new TestListResultSink[String]
Error:(47, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[Int]
Error:(82, 36) not found: type TestListResultSink
    val sideOutputResultSink = new TestListResultSink[String]
Error:(83, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[Int]
Error:(119, 36) not found: type TestListResultSink
    val sideOutputResultSink = new TestListResultSink[String]
Error:(120, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[Int]
Error:(152, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[String]
Error:(153, 30) not found: type TestListResultSink
    val lateResultSink = new TestListResultSink[(String, Int)]
Error:(196, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[String]
Error:(197, 30) not found: type TestListResultSink
    val lateResultSink = new TestListResultSink[(String, Int)]
Error:(242, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[String]
Error:(243, 36) not found: type TestListResultSink
    val sideOutputResultSink = new TestListResultSink[String]
Error:(289, 26) not found: type TestListResultSink
    val resultSink = new TestListResultSink[String]
Error:(290, 36) not found: type TestListResultSink
    val sideOutputResultSink = new TestListResultSink[String]

【问题讨论】:

  • 有人可以帮忙看看吗?谢谢

标签: apache-flink


【解决方案1】:

如果我在 GitHub.com 上搜索 TestListResultSink,我会找到 here。这告诉我它在flink-tests 模块中。您是否已将其包含在您的 IntelliJ 设置中?

【讨论】:

  • 谢谢@kkrugler。是的,我有课,当我 git clone 仓库时,所有东西都在我的本地机器中获取。
【解决方案2】:

我最终got org.apache.flink.examples.scala.wordcount.WordCount 在 IntelliJ 中运行,但这并不容易。我尝试了很多东西,但我认为这是通往成功的道路:

  1. 检查了 release-1.7 分支(可能没关系,但我想确定我使用的是经过良好测试的代码集)
  2. 在命令行上构建整个项目,通过mvn clean package -DskipTests
  3. 在 IntelliJ 中进行了无效缓存/重新启动(在 IntelliJ 中构建项目期间,我一直收到错误,直到我这样做)
  4. 构建项目(在 IntelliJ 中)
  5. 运行org.apache.flink.examples.scala.wordcount.WordCountorg.apache.flink.streaming.scala.examples.wordcount.WordCount

FWIW,Flink 二进制版本附带了一些示例的 jar 文件,可以在集群上运行而无需编译任何东西。这是让某些东西运行起来的一种更简单的方法。详情here

【讨论】:

  • 谢谢@David。在 IJ 中打开项目后,我也可以在没有任何特殊设置的情况下运行 org.apache.flink.examples.scala.wordcount.WordCount。我在问题中提到的问题是关于运行流模式字数:org.apache.flink.streaming.scala.examples.wordcount.WordCount
  • 抱歉,我的线被打断了,@Tom,但我现在也可以运行 org.apache.flink.streaming.scala.examples.wordcount.WordCount 了,因为我已经清理并构建了如上所述的项目。
【解决方案3】:

尝试构建您的项目,然后运行 ​​wordcount 示例!

mvn clean package -DskipTests

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-01
    • 2018-02-21
    • 2012-12-20
    • 2018-09-10
    • 2021-12-06
    • 2021-06-03
    • 2016-02-29
    • 2018-10-25
    相关资源
    最近更新 更多