i tried to install elasticsearch 5.3 inside my docker, after adding a new user elsearch with following commands:
groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
chown -R elsearch:elsearch /root/elasticsearch-5.3.0/
su elsearch
cd /root/elasticsearch-5.3.0/bin/
and i tried to run elasticsearch:
./elasticsearch
i get error:
Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from /usr/bin/java does not meet this requirement
and i run java -version:
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
the system of docker is ubuntu 14.04
uname -a
Linux ced2897c0f3f 4.8.0-46-generic #49~16.04.1-Ubuntu SMP Fri Mar 31 14:51:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
I am not sure how your running Elasticsearch "inside your docker" is the right way. You should build a separate container. Refer to our documentation here:
It's not clear to me how you've built your Docker image but all Elasticsearch distributions since 5.3.0 ship with a jar that contains org.elasticsearch.tools.JavaVersionChecker but it's clear that somehow you've lost that jar file. This is the root of your problem. Without more details, we can not help.
Enter to keep the current selection[+], or type selection number: 1
I Try to install zip (5.3.2) file in centos 7 machine:
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-514.el7.x86_64
Architecture: x86-64
I changed to openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
still i got this error: [siva@kfos-vmelk-1 bin]$ ./elasticsearch
Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from /bin/java does not meet this requirement
The problem might not appear be your Java version, the problem appears to be with your Elasticsearch installation first. Can you please list the contents of ../lib (from the directory where you were executing elasticsearch which you show as bin, go down one directory, and then into the lib directory. Please show the entire contents here.
7-05-05T01:48:39,567][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.4.0.jar:5.4.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:204) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elasticsearch-5.4.0.jar:5.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.4.0.jar:5.4.0]
... 6 more
[root@kfos-vmelk-1 bin]# su siva
[siva@kfos-vmelk-1 bin]$ pwd
/root/elk/5.4/elasticsearch-5.4.0/bin
[siva@kfos-vmelk-1 bin]$ ./elasticsearch
Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from /bin/java does not meet this requirement
Okay, the jar that we are looking for is there in both cases. Would you please run bash -x ./elasticsearch from the bin folder and share the results of the output here?
for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh '~/.elasticsearch.in.sh' '"$ES_HOME/bin/elasticsearch.in.sh"' '"dirname "$0""/elasticsearch.in.sh'
for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh '~/.elasticsearch.in.sh' '"$ES_HOME/bin/elasticsearch.in.sh"' '"dirname "$0""/elasticsearch.in.sh'
for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh '~/.elasticsearch.in.sh' '"$ES_HOME/bin/elasticsearch.in.sh"' '"dirname "$0""/elasticsearch.in.sh'
'[' -r /opt/elasticsearch/elasticsearch.in.sh ']'
for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh '~/.elasticsearch.in.sh' '"$ES_HOME/bin/elasticsearch.in.sh"' '"dirname "$0""/elasticsearch.in.sh'
'[' -r /home/siva/.elasticsearch.in.sh ']'
for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh '~/.elasticsearch.in.sh' '"$ES_HOME/bin/elasticsearch.in.sh"' '"dirname "$0""/elasticsearch.in.sh'
for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh '~/.elasticsearch.in.sh' '"$ES_HOME/bin/elasticsearch.in.sh"' '"dirname "$0""/elasticsearch.in.sh'
'[' -r ./elasticsearch.in.sh ']'
. ./elasticsearch.in.sh
++ '[' x '!=' x ']'
++ ES_CLASSPATH='/root/elk/5.3.2/elasticsearch-5.3.2/lib/elasticsearch-5.3.2.jar:/root/elk/5.3.2/elasticsearch-5.3.2/lib/*'
/bin/java -cp '/root/elk/5.3.2/elasticsearch-5.3.2/lib/elasticsearch-5.3.2.jar:/root/elk/5.3.2/elasticsearch-5.3.2/lib/*' org.elasticsearch.tools.JavaVersionChecker
Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
'[' 1 -ne 0 ']'
echo 'Elasticsearch requires at least Java 8 but your Java version from /bin/java does not meet this requirement'
Elasticsearch requires at least Java 8 but your Java version from /bin/java does not meet this requirement
I noticed this, this is in /root/; are you sure that you have the right permissions? I can reproduce your issue if I do this:
22:13:58 [jason@totoro:~/elasticsearch/elasticsearch-5.3.2/bin] $ chmod 000 ../lib
22:14:22 [jason@totoro:~/elasticsearch/elasticsearch-5.3.2/bin] $ ./elasticsearch
Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from /usr/java/latest/bin/java does not meet this requirement
You can not run Elasticsearch as root anyway, so let's get it out of the root folder and make sure you have the right permissions. I think the best way to make sure that you have the right permissions is to untar the tar archive again somewhere else.
You're welcome! You probably do, but for that we would need more details. Would you mind opening a new topic with more details of the problem and someone will take a look?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.