Flink Error: Could not find or load main class

Flink Error: Could not find or load main class

我正在尝试 运行 那些 Flink 基准测试: https://github.com/dataArtisans/flink-benchmarks

我已经使用带有该命令的 maven 生成了 jar 文件:

mvn clean package -Pbuild-jar

然后我尝试 运行 使用该命令在 Flink 集群上进行基准测试:

./bin/flink run -c org.apache.flink.benchmark.WindowBenchmarks ~/flinkBenchmarks/target/flink-hackathon-benchmarks-0.1.jar

我已经使用 -c 选项将我想要的基准测试 (WindowBenchmarks) 的 Main 添加到类路径中 运行。

最后,我得到了那个错误:

# JMH version: 1.19
# VM version: JDK 1.8.0_151, VM 25.151-b12
# VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
# VM options: -Dlog.file=/home/user/flink-1.3.2/flink-dist/target/flink-1.3.2-bin/flink-1.3.2/log/flink-user-client-mypc.log -Dlog4j.configuration=file:/home/user/flink-1.3.2/flink-dist/target/flink-1.3.2-bin/flink-1.3.2/conf/log4j-cli.properties -Dlogback.configurationFile=file:/home/user/flink-1.3.2/flink-dist/target/flink-1.3.2-bin/flink-1.3.2/conf/logback.xml -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
# Warmup: 10 iterations, 1 s each
# Measurement: 10 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: org.apache.flink.benchmark.WindowBenchmarks.sessionWindow

# Run progress: 0.00% complete, ETA 00:04:00
# Fork: 1 of 3
Error: Could not find or load main class org.openjdk.jmh.runner.ForkedMain
<forked VM failed with exit code 1>
<stdout last='20 lines'>
</stdout>
<stderr last='20 lines'>
Error: Could not find or load main class org.openjdk.jmh.runner.ForkedMain
</stderr>

# Run complete. Total time: 00:00:00

Benchmark  Mode  Cnt  Score   Error  Units

The program didn't contain a Flink job. Perhaps you forgot to call execute() on the execution environment.

我以前没有任何使用 Flink 和 Maven 的经验,所以我发现了缺少的东西。我的第一个想法是这是一个缺少依赖项错误,但它们看起来很好。有什么建议吗?

提前致谢!

flink-benchmarks 是一个存储库,其中包含旨在 运行 在单机而非集群上设计的微基准测试集。各种类(测试用例)中定义的main函数是'JMH'运行ners,不是Flink程序。因此,您可以执行整个基准测试套件(大约需要 1 小时):

mvn -Dflink.version=1.5.0 clean install exec:exec

或者如果你只想执行一个基准测试,最好的方法是手动执行选定的主要功能。例如,从您的 IDE(不要忘记选择 flink.version,属性 的默认值在 pom.xml 中定义)。

还有,不过好久没试了