flink启动报错:A JNI error has occurred, please check your installation and try again 解决方法

Posted mask哥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flink启动报错:A JNI error has occurred, please check your installation and try again 解决方法相关的知识,希望对你有一定的参考价值。

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" 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:650)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
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:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 7 more

修改maven pom.xml文件中scope provided为compile

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-java</artifactId>
    <version>${flink.version}</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-streaming-java_2.11</artifactId>
    <version>${flink.version}</version>
    <scope>provided</scope>
</dependency>

以上是关于flink启动报错:A JNI error has occurred, please check your installation and try again 解决方法的主要内容,如果未能解决你的问题,请参考以下文章

使用java命令出现Error: A JNI error has occurred, please check your installation and try again的错误

A JNI error has occurred, please check your installation and try again

Error: A JNI error has occurred, please check your installation and try again

Eclipse 运行导入的 Java 项目时,Error:A JNI error has occurred

Error: A JNI error has occurred, please check your installation and try again

Error: A JNI error has occurred, please check your installation and try again