Flink- 本地运行报错(Cannot find compatible factory for specified execution.target (=local))

本地运行报错信息

Exception in thread "main" java.lang.NullPointerException: Cannot find compatible factory for specified execution.target (=local)
	at org.apache.flink.util.Preconditions.checkNotNull(Preconditions.java:104)
	at org.apache.flink.api.java.ExecutionEnvironment.executeAsync(ExecutionEnvironment.java:937)
	at org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:860)
	at org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:844)
	at org.apache.flink.api.java.DataSet.collect(DataSet.java:413)
	at org.apache.flink.api.java.DataSet.print(DataSet.java:1652)
	at org.apache.flink.api.scala.DataSet.print(DataSet.scala:1864)
	at com.rz.flinkdemo.wc.WordCount$.main(WordCount.scala:22)
	at com.rz.flinkdemo.wc.WordCount.main(WordCount.scala)

 

原因:pom文件没有添flink流处理依赖

解决方法: pom文件添flink流处理依赖

<dependencies>
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-scala_2.12</artifactId>
            <version>1.10.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-streaming-scala_2.12</artifactId>
            <version>1.10.1</version>
            <!--<scope>provided</scope>-->
        </dependency>
    </dependencies>

  

posted @ 2020-09-05 18:18  RZ_Lee  阅读(844)  评论(0编辑  收藏  举报