1. 程式人生 > 實用技巧 >Flink1.11 解決 No ExecutorFactory found to execute the application

Flink1.11 解決 No ExecutorFactory found to execute the application

在使用Flink1.11的時候寫了個本地Test 執行的時候發現報錯了,具體如下

Exception in thread "main" java.lang.IllegalStateException: No ExecutorFactory found to execute the application.
    at org.apache.flink.core.execution.DefaultExecutorServiceLoader.getExecutorFactory(DefaultExecutorServiceLoader.java:84)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:
1801) at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1711) at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:74) at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:
1697) at com.bigdata.testKafkaUpsert.main(testKafkaUpsert.java:54)

檢視Flink1.11 release文件發現

Reversed dependency from flink-streaming-java to flink-client (FLINK-15090)
Starting from Flink 1.11.0, the flink-streaming-java module does not have a dependency on flink-clients anymore.
If your project was depending on this
transitive dependency you now have to add flink-clients as an explicit dependency.

從Flink 1.11.0 開始flink-streaming-java不再依賴flink-client需要單獨引用,那麼增加相應依賴即可解決

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-clients_${scala.binary.version}</artifactId>
            <version>${flink.version}</version>
            <scope>provided</scope>
        </dependency>

參考文件

https://ci.apache.org/projects/flink/flink-docs-stable/release-notes/flink-1.11.html#reversed-dependency-from-flink-streaming-java-to-flink-client-flink-15090