1. Exception 信息

1
2
3
4
5
6
Caused by: java.lang.NullPointerException: No execution.target specified in your configuration file.
	at org.apache.flink.util.Preconditions.checkNotNull(Preconditions.java:76)
	at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1942)
	at org.apache.flink.table.planner.delegation.ExecutorBase.executeAsync(ExecutorBase.java:55)
	at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeQueryOperation(TableEnvironmentImpl.java:793)
	... 3 more

2. 原因

声明执行环境时使用了new

1
StreamExecutionEnvironment env = new StreamExecutionEnvironment();

3. 解决

改成:

1
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();