Org.elasticsearch.bootstrap - JNA not found. native methods will be disabled


(@JPVay) #1

Hi everybody

org.elasticsearch.bootstrap - JNA not found. native methods will be disabled.

is the message i get. My es-cluster (1.7.2) is fully embedded.
libjna-java are installed (Ubuntu).
Is there a path or an env variable to set or an
.settings(ImmutableSettings.settingsBuilder()
.put("jna....whatever", somewhere) to use ?

Thank you.


(Jörg Prante) #2

If you run embedded, you need jna jar on the classpath.


(@JPVay) #3

Arrrrr. It was not in my fat jar !
It works. Thanks.


(padang) #4
  1. On 1.7.0, there is no long stacktrace reported. Is it expected that 2.0.0-beta has different reporting ?

  2. if jna.jar is required, should'it be in the maven dependencies ?

You can git clone https://github.com/ltregan/esregression then run "mvn test -Dtest=AppTest".

Here is the stack trace with 2.0.0-beta. It runs clean on 1.7.0.

You can try WARNING: JNA not found. native methods will be disabled.
java.lang.ClassNotFoundException: com.sun.jna.Native
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.elasticsearch.bootstrap.Natives.(Natives.java:43)
at org.elasticsearch.bootstrap.BootstrapInfo.isMemoryLocked(BootstrapInf
o.java:44)
at org.elasticsearch.monitor.process.ProcessProbe.processInfo(ProcessPro
be.java:139)
at org.elasticsearch.monitor.process.ProcessService.(ProcessServic


(@JPVay) #5
    <dependency>
        <groupId>net.java.dev.jna</groupId>
        <artifactId>jna</artifactId>
        <version>4.1.0</version>
    </dependency>

works for me with 1.7.2 and java jna lib install on ubuntu.


(Jörg Prante) #6

JNA is optional so that ES can be tested without mlockall or other native features.

The long stacktrace is new in 2.0 and there are different opinions about it but JNA is also really optional when using ES as client and not as a server, so the stacktrace may help to diagnose situations whether JNA is really required or not https://github.com/elastic/elasticsearch/issues/13245


(padang) #7

ok, thanks for the pointer to the issue !


(Mmaia) #8

Thanks, this works perfectly. It's really annoying to keep getting those error messages.


(尹鹏) #9

thanks for contributing!


(system) #10