Tag Archives: Flink knowledge system

[Solved] Flink TableAPI Error — > Class cannot be found

Console error:

"C:\Program Files\Java\jdk1.8.0_201\bin\java.exe" "-javaagent:D:\ideaSoftware\IntelliJ IDEA 2020.2.3\lib\idea_rt.jar=52126:D:\ideaSoftware\IntelliJ IDEA 2020.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_201\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\rt.jar;D:\Conding_pojoect\MyFlink\target\classes;D:\MyTools\repository\org\apache\flink\flink-clients_2.12\1.9.3\flink-clients_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-core\1.9.3\flink-core-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-annotations\1.9.3\flink-annotations-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-metrics-core\1.9.3\flink-metrics-core-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-asm-6\6.2.1-7.0\flink-shaded-asm-6-6.2.1-7.0.jar;D:\MyTools\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;D:\MyTools\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;D:\MyTools\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;D:\MyTools\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\MyTools\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\MyTools\repository\org\apache\commons\commons-compress\1.18\commons-compress-1.18.jar;D:\MyTools\repository\org\apache\flink\flink-runtime_2.12\1.9.3\flink-runtime_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-queryable-state-client-java\1.9.3\flink-queryable-state-client-java-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-hadoop-fs\1.9.3\flink-hadoop-fs-1.9.3.jar;D:\MyTools\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-netty\4.1.32.Final-7.0\flink-shaded-netty-4.1.32.Final-7.0.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-jackson\2.10.1-9.0\flink-shaded-jackson-2.10.1-9.0.jar;D:\MyTools\repository\org\javassist\javassist\3.19.0-GA\javassist-3.19.0-GA.jar;D:\MyTools\repository\org\scala-lang\scala-library\2.12.7\scala-library-2.12.7.jar;D:\MyTools\repository\com\typesafe\akka\akka-actor_2.12\2.5.21\akka-actor_2.12-2.5.21.jar;D:\MyTools\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;D:\MyTools\repository\org\scala-lang\modules\scala-java8-compat_2.12\0.8.0\scala-java8-compat_2.12-0.8.0.jar;D:\MyTools\repository\com\typesafe\akka\akka-stream_2.12\2.5.21\akka-stream_2.12-2.5.21.jar;D:\MyTools\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;D:\MyTools\repository\com\typesafe\ssl-config-core_2.12\0.3.7\ssl-config-core_2.12-0.3.7.jar;D:\MyTools\repository\org\scala-lang\modules\scala-parser-combinators_2.12\1.1.1\scala-parser-combinators_2.12-1.1.1.jar;D:\MyTools\repository\com\typesafe\akka\akka-protobuf_2.12\2.5.21\akka-protobuf_2.12-2.5.21.jar;D:\MyTools\repository\com\typesafe\akka\akka-slf4j_2.12\2.5.21\akka-slf4j_2.12-2.5.21.jar;D:\MyTools\repository\org\clapper\grizzled-slf4j_2.12\1.3.2\grizzled-slf4j_2.12-1.3.2.jar;D:\MyTools\repository\com\github\scopt\scopt_2.12\3.5.0\scopt_2.12-3.5.0.jar;D:\MyTools\repository\org\xerial\snappy\snappy-java\1.1.4\snappy-java-1.1.4.jar;D:\MyTools\repository\com\twitter\chill_2.12\0.7.6\chill_2.12-0.7.6.jar;D:\MyTools\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;D:\MyTools\repository\org\apache\flink\flink-optimizer_2.12\1.9.3\flink-optimizer_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-java\1.9.3\flink-java-1.9.3.jar;D:\MyTools\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;D:\MyTools\repository\org\slf4j\slf4j-api\1.7.15\slf4j-api-1.7.15.jar;D:\MyTools\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;D:\MyTools\repository\org\apache\flink\force-shading\1.9.3\force-shading-1.9.3.jar;D:\MyTools\repository\org\projectlombok\lombok\1.18.2\lombok-1.18.2.jar;D:\MyTools\repository\org\apache\flink\flink-streaming-java_2.12\1.9.3\flink-streaming-java_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-guava\18.0-7.0\flink-shaded-guava-18.0-7.0.jar;D:\MyTools\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;D:\MyTools\repository\org\apache\bahir\flink-connector-redis_2.11\1.0\flink-connector-redis_2.11-1.0.jar;D:\MyTools\repository\org\apache\flink\flink-streaming-java_2.11\1.2.0\flink-streaming-java_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\flink\flink-runtime_2.11\1.2.0\flink-runtime_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-hadoop2\1.2.0\flink-shaded-hadoop2-1.2.0.jar;D:\MyTools\repository\org\tukaani\xz\1.0\xz-1.0.jar;D:\MyTools\repository\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;D:\MyTools\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;D:\MyTools\repository\commons-net\commons-net\3.1\commons-net-3.1.jar;D:\MyTools\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\MyTools\repository\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;D:\MyTools\repository\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;D:\MyTools\repository\commons-el\commons-el\1.0\commons-el-1.0.jar;D:\MyTools\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;D:\MyTools\repository\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;D:\MyTools\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\MyTools\repository\commons-configuration\commons-configuration\1.7\commons-configuration-1.7.jar;D:\MyTools\repository\commons-digester\commons-digester\1.8.1\commons-digester-1.8.1.jar;D:\MyTools\repository\org\codehaus\jackson\jackson-core-asl\1.8.8\jackson-core-asl-1.8.8.jar;D:\MyTools\repository\org\codehaus\jackson\jackson-mapper-asl\1.8.8\jackson-mapper-asl-1.8.8.jar;D:\MyTools\repository\org\apache\avro\avro\1.7.7\avro-1.7.7.jar;D:\MyTools\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;D:\MyTools\repository\com\jcraft\jsch\0.1.42\jsch-0.1.42.jar;D:\MyTools\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.3\commons-beanutils-bean-collections-1.8.3.jar;D:\MyTools\repository\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;D:\MyTools\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;D:\MyTools\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\MyTools\repository\javax\activation\activation\1.1\activation-1.1.jar;D:\MyTools\repository\io\netty\netty-all\4.0.27.Final\netty-all-4.0.27.Final.jar;D:\MyTools\repository\com\data-artisans\flakka-actor_2.11\2.3-custom\flakka-actor_2.11-2.3-custom.jar;D:\MyTools\repository\com\data-artisans\flakka-remote_2.11\2.3-custom\flakka-remote_2.11-2.3-custom.jar;D:\MyTools\repository\io\netty\netty\3.8.0.Final\netty-3.8.0.Final.jar;D:\MyTools\repository\org\uncommons\maths\uncommons-maths\1.2.2a\uncommons-maths-1.2.2a.jar;D:\MyTools\repository\com\data-artisans\flakka-slf4j_2.11\2.3-custom\flakka-slf4j_2.11-2.3-custom.jar;D:\MyTools\repository\org\clapper\grizzled-slf4j_2.11\1.0.2\grizzled-slf4j_2.11-1.0.2.jar;D:\MyTools\repository\com\github\scopt\scopt_2.11\3.2.0\scopt_2.11-3.2.0.jar;D:\MyTools\repository\com\fasterxml\jackson\core\jackson-core\2.7.4\jackson-core-2.7.4.jar;D:\MyTools\repository\com\fasterxml\jackson\core\jackson-databind\2.7.4\jackson-databind-2.7.4.jar;D:\MyTools\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.0\jackson-annotations-2.7.0.jar;D:\MyTools\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;D:\MyTools\repository\org\slf4j\slf4j-log4j12\1.6.1\slf4j-log4j12-1.6.1.jar;D:\MyTools\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\MyTools\repository\jline\jline\0.9.94\jline-0.9.94.jar;D:\MyTools\repository\junit\junit\3.8.1\junit-3.8.1.jar;D:\MyTools\repository\com\twitter\chill_2.11\0.7.4\chill_2.11-0.7.4.jar;D:\MyTools\repository\org\apache\flink\flink-clients_2.11\1.2.0\flink-clients_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\flink\flink-optimizer_2.11\1.2.0\flink-optimizer_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\sling\org.apache.sling.commons.json\2.0.6\org.apache.sling.commons.json-2.0.6.jar;D:\MyTools\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;D:\MyTools\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar;D:\MyTools\repository\org\apache\flink\flink-statebackend-rocksdb_2.12\1.10.1\flink-statebackend-rocksdb_2.12-1.10.1.jar;D:\MyTools\repository\com\data-artisans\frocksdbjni\5.17.2-artisans-2.0\frocksdbjni-5.17.2-artisans-2.0.jar;D:\MyTools\repository\mysql\mysql-connector-java\8.0.25\mysql-connector-java-8.0.25.jar;D:\MyTools\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;D:\MyTools\repository\org\apache\flink\flink-table-planner_2.12\1.10.1\flink-table-planner_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-common\1.10.1\flink-table-common-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-asm-7\7.1-9.0\flink-shaded-asm-7-7.1-9.0.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-java-bridge_2.12\1.10.1\flink-table-api-java-bridge_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-scala-bridge_2.12\1.10.1\flink-table-api-scala-bridge_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-scala_2.12\1.10.1\flink-scala_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-streaming-scala_2.12\1.10.1\flink-streaming-scala_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-planner-blink_2.12\1.10.1\flink-table-planner-blink_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-java\1.10.1\flink-table-api-java-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-scala_2.12\1.10.1\flink-table-api-scala_2.12-1.10.1.jar;D:\MyTools\repository\org\scala-lang\scala-reflect\2.12.7\scala-reflect-2.12.7.jar;D:\MyTools\repository\org\scala-lang\scala-compiler\2.12.7\scala-compiler-2.12.7.jar;D:\MyTools\repository\org\scala-lang\modules\scala-xml_2.12\1.0.6\scala-xml_2.12-1.0.6.jar;D:\MyTools\repository\org\apache\flink\flink-table-runtime-blink_2.12\1.10.1\flink-table-runtime-blink_2.12-1.10.1.jar;D:\MyTools\repository\org\codehaus\janino\janino\3.0.9\janino-3.0.9.jar;D:\MyTools\repository\org\codehaus\janino\commons-compiler\3.0.9\commons-compiler-3.0.9.jar;D:\MyTools\repository\org\apache\calcite\avatica\avatica-core\1.15.0\avatica-core-1.15.0.jar;D:\MyTools\repository\org\reflections\reflections\0.9.10\reflections-0.9.10.jar" Com.ZQQQ.TableAPI.Example
21:39:36,292 INFO  org.apache.flink.api.java.typeutils.TypeExtractor             - class org.apache.flink.streaming.api.functions.source.TimestampedFileInputSplit does not contain a setter for field modificationTime
21:39:36,293 INFO  org.apache.flink.api.java.typeutils.TypeExtractor             - Class class org.apache.flink.streaming.api.functions.source.TimestampedFileInputSplit cannot be used as a POJO type because not all fields are valid POJO fields, and must be processed as GenericType. Please read the Flink documentation on "Data Types & Serialization" for details of the effect on performance.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/configuration/ReadableConfig
	at org.apache.flink.table.planner.StreamPlannerFactory.create(StreamPlannerFactory.java:49)
	at org.apache.flink.table.api.java.internal.StreamTableEnvironmentImpl.create(StreamTableEnvironmentImpl.java:120)
	at org.apache.flink.table.api.java.StreamTableEnvironment.create(StreamTableEnvironment.java:112)
	at org.apache.flink.table.api.java.StreamTableEnvironment.create(StreamTableEnvironment.java:83)
	at Com.ZQQQ.TableAPI.Example.main(Example.java:35)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.configuration.ReadableConfig
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 5 more

Process finished with exit code 1

Reason for the error.
It is caused by the inconsistency between the Flink version and the tableAPI version.
Solution.
Change all the pom.xml that involve flink version to the same version.

I configure the pom.xml file as follows

  <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-streaming-java -->
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-streaming-java_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.bahir/flink-connector-redis -->
    <dependency>
        <groupId>org.apache.bahir</groupId>
        <artifactId>flink-connector-redis_2.11</artifactId>
        <version>1.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-statebackend-rocksdb -->
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-statebackend-rocksdb_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>
	
        <!--TableAPI-->
    <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-table-planner -->
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-table-planner_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-table-planner-blink_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>