A JNI error has occurred, please check your installation and try again
Posted -JasonWang-
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A JNI error has occurred, please check your installation and try again相关的知识,希望对你有一定的参考价值。
运行 Flink 代码时,经常遇到这样的错误:
/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55981:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/tools.jar:/Users/jason93/IdeaProjects/Flink/target/classes:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-library.jar:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-xml_2.11-1.0.4.jar:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-parser-combinators_2.11-1.0.4.jar:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-actors-migration_2.11-1.1.0.jar:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-actors-2.11.0.jar:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-swing_2.11-1.0.2.jar:/Volumes/software/BigData/Scala/scala-2.11.8/lib/scala-reflect.jar:/Users/jason93/.m2/repository/org/xerial/snappy/snappy-java/1.1.4/snappy-java-1.1.4.jar:/Users/jason93/.m2/repository/org/slf4j/slf4j-api/1.7.15/slf4j-api-1.7.15.jar:/Users/jason93/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/Users/jason93/.m2/repository/org/apache/flink/force-shading/1.10.1/force-shading-1.10.1.jar:/Users/jason93/.m2/repository/org/apache/flink/flink-statebackend-rocksdb_2.11/1.10.1/flink-statebackend-rocksdb_2.11-1.10.1.jar:/Users/jason93/.m2/repository/com/data-artisans/frocksdbjni/5.17.2-artisans-2.0/frocksdbjni-5.17.2-artisans-2.0.jar:/Users/jason93/.m2/repository/joda-time/joda-time/2.7/joda-time-2.7.jar:/Users/jason93/.m2/repository/org/apache/bahir/flink-connector-redis_2.11/1.0/flink-connector-redis_2.11-1.0.jar:/Users/jason93/.m2/repository/redis/clients/jedis/2.8.0/jedis-2.8.0.jar:/Users/jason93/.m2/repository/org/apache/commons/commons-pool2/2.3/commons-pool2-2.3.jar:/Users/jason93/.m2/repository/org/apache/flink/flink-connector-kafka-0.10_2.11/1.10.1/flink-connector-kafka-0.10_2.11-1.10.1.jar:/Users/jason93/.m2/repository/org/apache/flink/flink-connector-kafka-0.9_2.11/1.10.1/flink-connector-kafka-0.9_2.11-1.10.1.jar:/Users/jason93/.m2/repository/org/apache/flink/flink-connector-kafka-base_2.11/1.10.1/flink-connector-kafka-base_2.11-1.10.1.jar:/Users/jason93/.m2/repository/org/apache/kafka/kafka-clients/0.10.2.2/kafka-clients-0.10.2.2.jar:/Users/jason93/.m2/repository/net/jpountz/lz4/lz4/1.3.0/lz4-1.3.0.jar flinkSource.SourceFile
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/functions/FlatMapFunction
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.api.common.functions.FlatMapFunction
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
Process finished with exit code 1
解决方法:
- 方法一:编辑代码变量,按下发图示打钩,然后再运行即可
- 方法二:修改
pom.xml
文件,找到<scope>provided</scope>
注释掉。
以上是关于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
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
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
使用java命令出现Error: A JNI error has occurred, please check your installation and try again的错误