【flink】Error reporting Could not instantiate the executor. Make sure a planner module is on the classpath
Preface
Flink version 1.15.1
scala version 2.12
I am studying recently Flink and I get an error when IDEA debugging Flink sql the code. The error content is as follows:
Exception in thread "main" org.apache.flink.table.api.TableException: Could not instantiate the executor. Make sure a planner module is on the classpath
at org.apache.flink.table.api.bridge.internal.AbstractStreamTableEnvironmentImpl.lookupExecutor(AbstractStreamTableEnvironmentImpl.java:108)
at org.apache.flink.table.api.bridge.java.internal.StreamTableEnvironmentImpl.create(StreamTableEnvironmentImpl.java:100)
at org.apache.flink.table.api.bridge.java.StreamTableEnvironment.create(StreamTableEnvironment.java:122)
at org.apache.flink.table.api.bridge.java.StreamTableEnvironment.create(StreamTableEnvironment.java:94)
at table.FlinkTableTest.main(FlinkTableTest.java:15)
Caused by: org.apache.flink.table.api.ValidationException: Multiple factories for identifier 'default' that implement 'org.apache.flink.table.delegation.ExecutorFactory' found in the classpath.
Ambiguous factory classes are:
org.apache.flink.table.planner.delegation.DefaultExecutorFactory
org.apache.flink.table.planner.loader.DelegateExecutorFactory
at org.apache.flink.table.factories.FactoryUtil.discoverFactory(FactoryUtil.java:553)
at org.apache.flink.table.api.bridge.internal.AbstractStreamTableEnvironmentImpl.lookupExecutor(AbstractStreamTableEnvironmentImpl.java:105)
... 4 more
Process finished with exit code 1
POM file
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_2.12</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-loader</artifactId>
<version>${flink.version}</version>
</dependency>
problem causes
pom.xml There are two parsers configured in our project file. These two parsers cannot coexist at the same time. We flink-table-planner_2.12 can remove this here.
Starting with Flink 1.15, the distribution includes two planners:
flink-table-planner_2.12-1.15.1.jar, in /opt, contains the query planner
flink-table-planner-loader-1.15.1.jar, loads /lib by default, contains the query planner hidden behind the isolation classpath
Note: Two planners cannot exist on the classpath at the same time . If you load them both into the /lib table job, it will fail.
problem solved!
Reference: https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/dev/configuration/advanced/