Hi  ALL,

OS:   CentOS 7.9

Flink version:  1.16.0


It looks like  I'm hitting a  notorious exception which had been discoverd since earlier fink version.  The issue was triggered

when below java code executed:

   StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);

More detailed trace is as below :

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:109)
        at 
org.apache.flink.table.api.bridge.java.internal.StreamTableEnvironmentImpl.create(StreamTableEnvironmentImpl.java:101)
        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 
com.sugon.cloud.paas.flink.cdc.FlinkCDC_mysql2doris_example.main(FlinkCDC_mysql2doris_example.java:63)

Caused by: org.apache.flink.table.api.ValidationException: Could not find any 
factories that implement 'org.apache.flink.table.delegation.ExecutorFactory' in 
the classpath.
        at 
org.apache.flink.table.factories.FactoryUtil.discoverFactory(FactoryUtil.java:533)
        at 
org.apache.flink.table.api.bridge.internal.AbstractStreamTableEnvironmentImpl.lookupExecutor(AbstractStreamTableEnvironmentImpl.java:106)
        ... 4 more



What I've done:
1) Added missed dependencies in "pom.xml",  for example:

<dependency>

    <groupId>org.apache.flink</groupId>

    <artifactId>flink-table-api-java-uber</artifactId>

    <version>1.16.1</version>

    <scope>provided</scope>

</dependency>


<dependency>

   <!-- this is needed to use the Table API from unit tests -->

   <groupId>org.apache.flink</groupId>

   <artifactId>flink-table-planner_${scala.binary.version}</artifactId>

   <version>${flink.version}</version>

   <scope>provided</scope>

</dependency>


2)Tried two methods to run application, got same error(see above)
mvn exec:java -Dexec.mainClass="xxx"

   java -jar target/xxx.jar


   I'm confused by the error because all necessary jar files does exist in 
Maven's local repository
or FLINK_HOME's lib dir.


The completed "pom.xml" is included in attachment.


Thanks,
Leo



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany.cloud.bigdata.flink</groupId>
  <artifactId>flink-cdc-doris-example</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <flink.version>1.16.0</flink.version>
    <flink.connector.version>2.3.0</flink.connector.version>
    <scala.binary.version>2.12</scala.binary.version>

  </properties>

  <dependencies>
    <!-- Flink 依赖 -->
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-java</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-java</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-table-api-java-bridge</artifactId>
      <version>${flink.version}</version>
    </dependency>

    <!-- Flink CDC 依赖 -->
    <dependency>
      <groupId>com.ververica</groupId>
      <artifactId>flink-connector-mysql-cdc</artifactId>
      <version>${flink.connector.version}</version>
    </dependency>


    <dependency>
      <!-- this is needed to use the Table API from unit tests -->
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-table-planner_${scala.binary.version}</artifactId>
      <version>${flink.version}</version>
      <scope>provided</scope>
    </dependency>


    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-table-api-java-uber</artifactId>
      <version>${flink.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                
                
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.mycompany.cloud.bigdata.flink.cdc.FlinkCDC_mysql2doris_example</mainClass>
                </transformer>
              </transformers>
              <artifactSet>
                <excludes>
                  <exclude>org.apache.flink:force-shading</exclude>
                </excludes>
              </artifactSet>
              <filters>
                 <filter>
                    <artifact>*:*</artifact>
                    <excludes>
                      <exclude>META-INF/*.SF</exclude>
                      <exclude>META-INF/*.DSA</exclude>
                      <exclude>META-INF/*.RSA</exclude>
                    </excludes>
                 </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
 </project> 

回复