8
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.

Gene
  • 159
  • 1
  • 2
  • 10

4 Answers4

22

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

kkrugler
  • 8,145
  • 6
  • 24
  • 18
  • I tried before, it doesn't work for me. I mentioned in above explanation. – Gene Jul 23 '20 at 01:41
  • It seems to work when you put dependency in the correct place. Order of maven dependencies matter: https://stackoverflow.com/a/31743617/710162 – Daniel Argüelles Jul 23 '20 at 18:04
  • 2
    If you are running from IntelliJ, and the dependency is in `provided` scope, you need to tick the "Include Dependencies with 'Provided' scope" box in the run configuration. – Robert Metzger Aug 19 '20 at 06:41
2

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

Keipro
  • 95
  • 1
  • 1
  • 13
1

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.
Gene
  • 159
  • 1
  • 2
  • 10
0

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>
...
Ben L.
  • 787
  • 10
  • 18