While building Docker file, installation of elasticsearch-plugin fails with "Error: Could not find or load main class org.elasticsearch.tools.launchers.JavaVersionChecker". It fails for ElasticSearch 6.4.x and 6.5.x versions.
I have seen previous links and blogs mentioned in the below links.
- Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
- Could not find or load main class org.elasticsearch.tools.launchers.JavaVersionChecker
- https://github.com/elastic/elasticsearch/issues/27599
According to the above links, have changed the owner given the necessary permissions and running as non-root user. VM and jvm are both 64 bit.
The same Docker file we were using it for 5.6,6.2 and 6.3 versions of ElasticSearch. It fails for 6.4 and 6.5 versions of ElasticSearch. DockerFile is below.
FROM $BASE_IMAGE
ARG ELASTICSEARCH_VERSION=6.4.0
ENV ELASTICSEARCH_VERSION $ELASTICSEARCH_VERSION
ENV LOCK_ALL true
default value for PATH_REPO_LOCATION based on dir created
ENV PATH_REPO_LOCATION /opt/ca/elasticsearch/backup
ENV ZEN_MINIMUM_MASTER_NODES 2
WORKDIR /opt/ca
ADD docker/startElasticsearch.sh .
USER root
Download and install Elasticsearch
RUN yum install -y wget unzip dos2unix libcgroup-tools &&
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.zip &&
unzip elasticsearch-$ELASTICSEARCH_VERSION.zip &&
rm -f elasticsearch-$ELASTICSEARCH_VERSION.zip &&
mv elasticsearch-$ELASTICSEARCH_VERSION /opt/ca/elasticsearch &&
cd /opt/ca/elasticsearch/lib &&
mkdir -p $PATH_REPO_LOCATION &&
mkdir -p /var/log/elasticsearch &&
mkdir -p /var/data/elasticsearch &&
chown -R 1010 /opt/ca &&
chown -R 1010 /var/data/elasticsearch &&
chown -R 1010 /var/log/elasticsearch &&
chown -R 1010 $PATH_REPO_LOCATION &&
chmod -R 777 $PATH_REPO_LOCATION &&
echo "vm.max_map_count=262144" >> /etc/sysctl.conf &&
echo "fs.file-max = 65536" >> /etc/sysctl.conf &&
yum clean all
RUN os_type=uname -p
&& if [[ "$os_type" == "s390x" ]];
then echo " bootstrap.system_call_filter: false" >> /opt/ca/elasticsearch/config/elasticsearch.yml;
sed -i "/8:-Xloggc:logs/gc.log/d" /opt/ca/elasticsearch/config/jvm.options;
fi
Download and install S3 Repository Plugin
COPY elasticsearch-env /opt/ca/elasticsearch/bin/elasticsearch-env
RUN chown -R 1010 /opt/ca/elasticsearch/bin
RUN chmod -R 777 /opt/ca/elasticsearch/
USER 1010
RUN /opt/ca/elasticsearch/bin/elasticsearch-plugin install --batch repository-s3
VOLUME ["/var/log/elasticsearch", "/var/data/elasticsearch", "/opt/ca/elasticsearch/backup"]
Have run the strace command and below is the output.
strace /usr/bin/java -cp 'lib/*' org.elasticsearch.tools.JavaVersionChecker