1.报错内容
D:\IDE\jdk1.8.0_221\bin\java.exe -Dvisualgc.id=204240167985500 -javaagent:D:\IntelliJIDEA20213\lib\idea_rt.jar=8042:D:\IntelliJIDEA20213\bin -Dfile.encoding=UTF-8 -classpath D:\IDE\jdk1.8.0_221\jre\lib\charsets.jar;D:\IDE\jdk1.8.0_221\jre\lib\deploy.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\dnsns.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\jaccess.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\localedata.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\nashorn.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\sunec.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;D:\IDE\jdk1.8.0_221\jre\lib\ext\zipfs.jar;D:\IDE\jdk1.8.0_221\jre\lib\javaws.jar;D:\IDE\jdk1.8.0_221\jre\lib\jce.jar;D:\IDE\jdk1.8.0_221\jre\lib\jfr.jar;D:\IDE\jdk1.8.0_221\jre\lib\jfxswt.jar;D:\IDE\jdk1.8.0_221\jre\lib\jsse.jar;D:\IDE\jdk1.8.0_221\jre\lib\management-agent.jar;D:\IDE\jdk1.8.0_221\jre\lib\plugin.jar;D:\IDE\jdk1.8.0_221\jre\lib\resources.jar;D:\IDE\jdk1.8.0_221\jre\lib\rt.jar;F:\Bitbucket\kungeek-middle-end\target\classes;D:\Maven\LocalRepository\com\alibaba\fastjson\1.2.4\fastjson-1.2.4.jar;D:\Maven\LocalRepository\org\apache\kafka\kafka-clients\2.8.0\kafka-clients-2.8.0.jar;D:\Maven\LocalRepository\com\github\luben\zstd-jni\1.4.9-1\zstd-jni-1.4.9-1.jar;D:\Maven\LocalRepository\org\lz4\lz4-java\1.7.1\lz4-java-1.7.1.jar;D:\Maven\LocalRepository\org\xerial\snappy\snappy-java\1.1.8.1\snappy-java-1.1.8.1.jar;D:\Maven\LocalRepository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\Maven\LocalRepository\org\apache\flink\flink-connector-kafka_2.11\1.11.6\flink-connector-kafka_2.11-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-connector-kafka-base_2.11\1.11.6\flink-connector-kafka-base_2.11-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\force-shading\1.11.6\force-shading-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-core\1.11.6\flink-core-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-annotations\1.11.6\flink-annotations-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-metrics-core\1.11.6\flink-metrics-core-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-shaded-asm-7\7.1-11.0\flink-shaded-asm-7-7.1-11.0.jar;D:\Maven\LocalRepository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;D:\Maven\LocalRepository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;D:\Maven\LocalRepository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;D:\Maven\LocalRepository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\Maven\LocalRepository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\Maven\LocalRepository\org\apache\commons\commons-compress\1.20\commons-compress-1.20.jar;D:\Maven\LocalRepository\org\apache\flink\flink-runtime_2.11\1.11.6\flink-runtime_2.11-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-queryable-state-client-java\1.11.6\flink-queryable-state-client-java-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-hadoop-fs\1.11.6\flink-hadoop-fs-1.11.6.jar;D:\Maven\LocalRepository\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\Maven\LocalRepository\org\apache\flink\flink-shaded-netty\4.1.39.Final-11.0\flink-shaded-netty-4.1.39.Final-11.0.jar;D:\Maven\LocalRepository\org\apache\flink\flink-shaded-jackson\2.10.1-11.0\flink-shaded-jackson-2.10.1-11.0.jar;D:\Maven\LocalRepository\org\apache\flink\flink-shaded-zookeeper-3\3.4.14-11.0\flink-shaded-zookeeper-3-3.4.14-11.0.jar;D:\Maven\LocalRepository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;D:\Maven\LocalRepository\org\scala-lang\scala-library\2.11.12\scala-library-2.11.12.jar;D:\Maven\LocalRepository\com\typesafe\akka\akka-actor_2.11\2.5.21\akka-actor_2.11-2.5.21.jar;D:\Maven\LocalRepository\com\typesafe\config\1.3.3\config-1.3.3.jar;D:\Maven\LocalRepository\org\scala-lang\modules\scala-java8-compat_2.11\0.7.0\scala-java8-compat_2.11-0.7.0.jar;D:\Maven\LocalRepository\com\typesafe\akka\akka-stream_2.11\2.5.21\akka-stream_2.11-2.5.21.jar;D:\Maven\LocalRepository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;D:\Maven\LocalRepository\com\typesafe\ssl-config-core_2.11\0.3.7\ssl-config-core_2.11-0.3.7.jar;D:\Maven\LocalRepository\org\scala-lang\modules\scala-parser-combinators_2.11\1.1.1\scala-parser-combinators_2.11-1.1.1.jar;D:\Maven\LocalRepository\com\typesafe\akka\akka-protobuf_2.11\2.5.21\akka-protobuf_2.11-2.5.21.jar;D:\Maven\LocalRepository\com\typesafe\akka\akka-slf4j_2.11\2.5.21\akka-slf4j_2.11-2.5.21.jar;D:\Maven\LocalRepository\org\clapper\grizzled-slf4j_2.11\1.3.2\grizzled-slf4j_2.11-1.3.2.jar;D:\Maven\LocalRepository\com\github\scopt\scopt_2.11\3.5.0\scopt_2.11-3.5.0.jar;D:\Maven\LocalRepository\com\twitter\chill_2.11\0.7.6\chill_2.11-0.7.6.jar;D:\Maven\LocalRepository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-java\1.11.6\flink-java-1.11.6.jar;D:\Maven\LocalRepository\org\apache\flink\flink-shaded-guava\18.0-11.0\flink-shaded-guava-18.0-11.0.jar;D:\Maven\LocalRepository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;D:\Maven\LocalRepository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;D:\Maven\LocalRepository\org\slf4j\slf4j-nop\1.7.2\slf4j-nop-1.7.2.jar;D:\Maven\LocalRepository\org\apache\flink\flink-clients_2.11\1.11.0\flink-clients_2.11-1.11.0.jar;D:\Maven\LocalRepository\org\apache\flink\flink-optimizer_2.11\1.11.0\flink-optimizer_2.11-1.11.0.jar;D:\Maven\LocalRepository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar com.kungeek.rtdw.stg.DataCrushers
java.lang.NoClassDefFoundError: org/apache/flink/streaming/api/functions/source/SourceFunction
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.streaming.api.functions.source.SourceFunction
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)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
Process finished with exit code 1
2.解决方案
将对应依赖包作用域调整为compile
3.定位依赖项
报错内容中找不到的类所在的依赖即为需调整内容。
4.操作演示
4.1 修改前
4.2 修改后
4.3 注意事项
修改完依赖配置,记得更新依赖。