I have Elasticsearch 7.9 and it doesn't start. How fix this problem?
- Centos 7
- Java version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
#sudo systemctl start elasticsearch.service
Job for elasticsearch.service failed because the control process exited with error code. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
journalctl -xe
Starting Elasticsearch...
-- Subject: Unit elasticsearch.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit elasticsearch.service has begun starting up.
dovecot[2155]: imap-login: Login: user=<cpanel-ccs>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=8188, TLS, session=<tFy2AXytVK1/AAAB>
dovecot[2155]: imap(cpanel-ccs)<8188><tFy2AXytVK1/AAAB>: Logged out in=50, out=862, bytes=50/862
systemd-entrypoint[7971]: fatal error in thread [main], exiting
systemd-entrypoint[7971]: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
systemd-entrypoint[7971]: at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34)
systemd-entrypoint[7971]: at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
systemd-entrypoint[7971]: at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:33)
systemd-entrypoint[7971]: at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:126)
systemd-entrypoint[7971]: at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:137)
systemd-entrypoint[7971]: at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
systemd-entrypoint[7971]: at org.elasticsearch.node.Node.start(Node.java:868)
systemd-entrypoint[7971]: at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:317)
systemd-entrypoint[7971]: at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:402)
systemd-entrypoint[7971]: at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
systemd-entrypoint[7971]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
systemd-entrypoint[7971]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
systemd-entrypoint[7971]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
systemd-entrypoint[7971]: at org.elasticsearch.cli.Command.main(Command.java:90)
systemd-entrypoint[7971]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
systemd-entrypoint[7971]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit elasticsearch.service has failed.
--
-- The result is failed.
systemd[1]: Unit elasticsearch.service entered failed state.
systemd[1]: elasticsearch.service failed.
var/log/elasticsearch/elasticsearch.log
[ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] fatal error in thread [main], exiting
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:312) ~[?:?]
at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:33) ~[?:?]
at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:126) ~[?:?]
at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:137) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1510) ~[?:?]
at org.elasticsearch.node.Node.start(Node.java:868) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:317) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:402) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.9.0.jar:7.9.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.9.0.jar:7.9.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.9.0.jar:7.9.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.9.0.jar:7.9.0]
#sudo systemctl status elasticsearch
elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2020-08-22 22:49:51 EEST; 8min ago
Docs: https://www.elastic.co
Process: 16498 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 16498 (code=exited, status=1/FAILURE)
CGroup: /system.slice/elasticsearch.service
systemd-entrypoint[16498]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
systemd-entrypoint[16498]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
systemd-entrypoint[16498]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
systemd-entrypoint[16498]: at org.elasticsearch.cli.Command.main(Command.java:90)
systemd-entrypoint[16498]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
systemd-entrypoint[16498]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Elasticsearch.
systemd[1]: Unit elasticsearch.service entered failed state.
systemd[1]: elasticsearch.service failed.
Tested and doesn't work: https://stackoverflow.com/a/63422363
1. Set ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
in /etc/sysconfig/elasticsearch
2. mkdir -p /var/lib/elasticsearch/tmp
3. chown -R elasticsearch.elasticsearch /var/lib/elasticsearch/tmp