upgraded flink from 1.10 to 1.11, met error 'No ExecutorFactory found to execute the application'

Viewed 4606
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:1803)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1713)
    at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:74)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1699)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1681)
    at com.cep.StaticAlarmGenerationEntryTest.main(StaticAlarmGenerationEntryTest.java:149)

The error I met after I upgraded FLink from 1.10 to 1.11, and my IDE is eclipse. and I tried to add artifactId:flink-clients_${scala.binary.version}, but still failed. Anybody already met and solved this issue, pls tell me. thanks a lot.

4 Answers

See the 1.11 release note, where you now have to add an explicit dependency on flink-clients.

I have solved my problem this way :

1.Use Java 8, apparently Flink has some sort of problem with Java 11 or 15

2.Change all the Scopes to "compile" you can change scopes in this path : Project Structure → Modules → Dependencies → There is a table that one of its column's name is Scope

enter image description here

I found the reason why the error happened event I add dependency flink-clients. I upgraded Flink from 1.10 to 1.11, just edited the version of Flink, but not changed Scala version. Here also should change Scala version to 2.12. And the project is generated base on 1.10 archetype and Scala version is 2.11. Every time I build the project, it use the 2.11 environments. So the fast way to solve this issue is :

  1. use mvn archetype:generate -DarchetypeGroupId=org.apache.flink -DarchetypeArtifactId=flink-quickstart-java -DarchetypeVersion=1.11.0 this command to generate new project.
  2. copy all your old code to this new project. You will find that the flink-clinets already added in the pom.xml.

I had this problem when I was packaging up the flink job in a shaded jar. When shading, if there are files with the same name in multiple jars it will overwrite the file as it unzips each jar into the new shaded jar.

Flink uses the file META-INF/services/org.apache.flink.core.execution.PipelineExecutorFactory to discover different executor factories and this file is present in multiple jars, each with different contents.

To fix this, I had to tell the maven-shade plugin to combine these files together as it came across them, and this solved the problem for me.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>job</shadedClassifierName>
                <transformers>
                    <!-- add this to combine the PipelineExecutorFactory files into one -->
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/services/org.apache.flink.core.execution.PipelineExecutorFactory</resource>
                    </transformer>
                </transformers>
...
Related