【Flink】:No operators defined in streaming topology. Cannot execute.

在运行Flink的时候出现如下问题

Exception in thread "main" java.lang.IllegalStateException: No operators defined in streaming topology. Cannot execute.
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraphGenerator(StreamExecutionEnvironment.java:2018)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraph(StreamExecutionEnvironment.java:2009)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraph(StreamExecutionEnvironment.java:1994)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1833)
    at com.demo.DataGenDemo.main(DataGenDemo.java:48)
 

 问题解决:Flink编程分为几个部分,Source,Transformation,Sink

如果少了sink就会出现上面的问题,出现问题的代码如下

package com.demo;

import org.apache.flink.api.c

你可能感兴趣的:(Flink实战,flink)