java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native

Hi,

Greetings !!

I have installed ES 7.9 version and jdk 8u202 version. But unable to start the ES service.
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: fatal error in thread [main], exiting
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.systemd.Libsystemd.(Libsystemd.java:33)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:126)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:137)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.node.Node.start(Node.java:868)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:317)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:402)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.cli.Command.main(Command.java:90)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
Sep 13 16:03:20 FRAKHRPL100N systemd-entrypoint[72677]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)

What is your OS? What type of hardware are you deploying on?

RHEL 7, RAM 8GB HDD 80GB

Why are you not using the JVM that comes bundled with Elasticsearch?

Currently we are running with very old ELK version(i hope you are aware), my infra is completely build with RHEL. So, i am just installing newer version of ELK in single machine to test the require things which we are going to use.

I still do not understand why you are not using the bundled JVM. I would at least test it to see if that resolves the issue.

I am really sorry Christian, i am not getting you what exactly you are saying.

My ES version:
/usr/share/elasticsearch/bin/elasticsearch --version
Version: 7.9.1, Build: default/rpm/083627f112ba94dffc1232e8b42b73492789ef91/2020-09-01T21:22:21.964974Z, JVM: 14.0.1

This was what confused me. If you are using that JVM I am not sure what is wrong. What do you get if you run uname -m?

x86_64

Then I am out of ideas. Let's see if anyone else have come across this.

:frowning: :frowning: :frowning:

It is freshly installed one. and i am ready to reinstall if you have any links which helps me with step by step installation instruction of ELK 7.9 on RHEL 7

I have found below details in log (/var/log/elasticsearch)

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) [elasticsearch-cli-7.9.1.jar:7.9.1]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-7.9.1.jar:7.9.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-7.9.1.jar:7.9.1]
[2020-09-13T16:58:01,507][WARN ][o.e.b.Natives ] [FRAKHRPL100N] cannot check if running as root because JNA is not available
[2020-09-13T16:58:01,507][WARN ][o.e.b.Natives ] [FRAKHRPL100N] cannot install system call filter because JNA is not available
[2020-09-13T16:58:01,508][WARN ][o.e.b.Natives ] [FRAKHRPL100N] cannot register console handler because JNA is not available
[2020-09-13T16:58:01,509][WARN ][o.e.b.Natives ] [FRAKHRPL100N] cannot getrlimit RLIMIT_NPROC because JNA is not available
[2020-09-13T16:58:01,509][WARN ][o.e.b.Natives ] [FRAKHRPL100N] cannot getrlimit RLIMIT_AS because JNA is not available
[2020-09-13T16:58:01,510][WARN ][o.e.b.Natives ] [FRAKHRPL100N] cannot getrlimit RLIMIT_FSIZE because JNA is not available
[2020-09-13T16:58:01,957][INFO ][o.e.n.Node ] [FRAKHRPL100N] version[7.9.1], pid[75824], build[default/rpm/083627f112ba94dffc1232e8b42b73492789ef91/2020-09-01T21:22:21.964974Z], OS[Linux/3.10.0-1127.18.2.el7.x86_64/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/14.0.1/14.0.1+7]
[2020-09-13T16:58:01,970][INFO ][o.e.n.Node ] [FRAKHRPL100N] JVM home [/usr/share/elasticsearch/jdk]
[2020-09-13T16:58:01,971][INFO ][o.e.n.Node ] [FRAKHRPL100N] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, -Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:G1ReservePercent=25, -XX:InitiatingHeapOccupancyPercent=30, -Djava.io.tmpdir=/tmp/elasticsearch-11637351746200502192, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=/var/lib/elasticsearch, -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/etc/elasticsearch, -Des.distribution.flavor=default, -Des.distribution.type=rpm, -Des.bundled_jdk=true]

Service started ref link (https://stackoverflow.com/questions/47824643/unable-to-load-jna-native-support-library-elasticsearch-6-x/50371992#50371992)
service elasticsearch status
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2020-09-13 17:22:50 CEST; 21s ago
Docs: https://www.elastic.co
Main PID: 77699 (java)
CGroup: /system.slice/elasticsearch.service
├─77699 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=tru...
└─77864 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller