错误如下 :
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.flink.optimizer.plantranslate.JobGraphGenerator.addUserArtifactEntries(Ljava/util/Collection;Lorg/apache/flink/runtime/jobgraph/JobGraph;)V
at org.apache.flink.streaming.api.graph.StreamingJobGraphGenerator.createJobGraph(StreamingJobGraphGenerator.java:183)
at org.apache.flink.streaming.api.graph.StreamingJobGraphGenerator.createJobGraph(StreamingJobGraphGenerator.java:104)
at org.apache.flink.streaming.api.graph.StreamGraph.getJobGraph(StreamGraph.java:777)
at org.apache.flink.streaming.api.graph.StreamGraphTranslator.translateToJobGraph(StreamGraphTranslator.java:52)
at org.apache.flink.client.FlinkPipelineTranslationUtil.getJobGraph(FlinkPipelineTranslationUtil.java:43)
at org.apache.flink.client.deployment.executors.LocalExecutor.getJobGraph(LocalExecutor.java:98)
at org.apache.flink.client.deployment.executors.LocalExecutor.execute(LocalExecutor.java:79)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1740)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1641)
at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:74)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1627)
at com.gongzhugou.realtime.commmon.StreamBaseEnvironment.execute(StreamBaseEnvironment.java:128)
at com.gongzhugou.realtime.commmon.StreamBaseEnvironment.start(StreamBaseEnvironment.java:38)
at com.gongzhugou.realtime.flink.product.ProductSaleVolume.main(ProductSaleVolume.java:43)ava
原因
Flink 中引入下面的依赖。 删除掉就好了。
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
原因是 因为这个包在其他的里面已经存在, 比如下面的这个包中就存在。
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>