Elasticsearch - JNA

问题

在Ubuntu下面启动Elasticsearch的时候提示如下错误:

unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-x86/libjnidispatch.so) not found

详细错误:

flying-bird@flyingbird:~/elk$ ./elasticsearch-5.5.2/bin/elasticsearch -p my_cluster/node1_pid -Epath.conf=./my_cluster/node1/config
[2017-08-28T20:39:04,823][WARN ][o.e.b.Natives            ] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-x86/libjnidispatch.so) not found in resource path (...)
    at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962) ~[jna-4.4.0.jar:4.4.0 (b0)]
    at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) ~[jna-4.4.0.jar:4.4.0 (b0)]
    at com.sun.jna.Native.(Native.java:190) ~[jna-4.4.0.jar:4.4.0 (b0)]
    at java.lang.Class.forName0(Native Method) ~[?:1.8.0_05]
    at java.lang.Class.forName(Class.java:259) ~[?:1.8.0_05]
    at org.elasticsearch.bootstrap.Natives.(Natives.java:45) [elasticsearch-5.5.2.jar:5.5.2]
    ...
[2017-08-28T20:39:04,829][WARN ][o.e.b.Natives            ] cannot check if running as root because JNA is not available
[2017-08-28T20:39:04,829][WARN ][o.e.b.Natives            ] cannot install system call filter because JNA is not available
[2017-08-28T20:39:04,830][WARN ][o.e.b.Natives            ] cannot register console handler because JNA is not available
[2017-08-28T20:39:04,832][WARN ][o.e.b.Natives            ] cannot getrlimit RLIMIT_NPROC because JNA is not available
[2017-08-28T20:39:04,832][WARN ][o.e.b.Natives            ] cannot getrlimit RLIMIT_AS beacuse JNA is not available
[2017-08-28T20:39:04,992][INFO ][o.e.n.Node               ] [node1] initializing ...

Ubuntu环境

flying-bird@flyingbird:~/elk/jna-jna-5.0.0$ uname -a
Linux flyingbird 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:20:08 UTC 2016 i686 i686 i686 GNU/Linux

解决办法

  • 直接删除或备份Elasticsearch-a.b.c/lib目录下面的jna文件:

    mv jna-4.4.0.jar jna-4.4.0.jar.bak

  • 在lib目录下:

    wget http://repo1.maven.org/maven2/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar

附 其他尝试

从https://github.com/java-native-access/jna下载jna-jna-5.0.0.zip,使用jna-jna-5.0.0/dist/linux-x86.jar
和jna-jna-5.0.0/lib/native/linux-x86.jar,均不可用。

最后比较前面wget的文件,和jna-jna-5.0.0中所有的jar,发现这个文件和dist/jna.jar完全一样。

你可能感兴趣的:(Web)