While installing elasticsearch on my Scientific Linux 6.5, I encountered the following error:
[root@meg ELK]# Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
^C
This error is generated because JDK version on the system is not present or it needs to be updated.
I downloaded latest version of JDK from Oracle site - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
The steps to configure the latest java on the system are described below:
[root@meg ELK]# rpm -e elasticsearch
warning: /etc/elasticsearch/elasticsearch.yml saved as /etc/elasticsearch/elasticsearch.yml.rpmsave
[root@meg ELK]# rpm -ivh elasticsearch-
elasticsearch-1.4.0.noarch.rpm elasticsearch-head-master.zip
[root@meg ELK]# rpm -ivh jdk-
jdk-7u71-linux-x64.rpm jdk-8u31-linux-x64.rpm
[root@meg ELK]# rpm -ivh jdk-8u31-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk1.8.0_31 ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...
[root@meg ELK]# ja
jar java javac javadoc javaws
[root@meg ELK]# java -version
java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (rhel-1.13.5.0.el6_6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
[root@meg ELK]# ls -l /usr/share/java
java/ java-1.3.1/ java-1.4.0/ java-1.4.1/ java-1.4.2/ java-1.5.0/ java-1.6.0/ java-1.7.0/ javadoc/ java-ext/ java-utils/ javazi/
[root@meg ELK]# ls -l /usr/java/jdk1.7.0_71/
bin/ jre/ README.html THIRDPARTYLICENSEREADME.txt
COPYRIGHT lib/ release
db/ LICENSE src.zip
include/ man/ THIRDPARTYLICENSEREADME-JAVAFX.txt
[root@meg ELK]# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_71/bin/java 2
[root@meg ELK]# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/java/jdk1.7.0_71/bin/java
Enter to keep the current selection[+], or type selection number: 2
[root@meg ELK]# java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
[root@meg ELK]# rpm -ivh elasticsearch-
elasticsearch-1.4.0.noarch.rpm elasticsearch-head-master.zip
[root@meg ELK]# rpm -ivh elasticsearch-1.4.0.noarch.rpm
Preparing... ########################################### [100%]
1:elasticsearch ########################################### [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch to start automatically using chkconfig
sudo /sbin/chkconfig --add elasticsearch
### You can start elasticsearch by executing
sudo service elasticsearch start
[root@meg ELK]# vim /etc/elasticsearch/elasticsearch.yml
[root@meg ELK]# service elasticsearch start
Starting elasticsearch: [ OK ]
[root@meg ELK]# Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
^C
This error is generated because JDK version on the system is not present or it needs to be updated.
I downloaded latest version of JDK from Oracle site - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
The steps to configure the latest java on the system are described below:
[root@meg ELK]# rpm -e elasticsearch
warning: /etc/elasticsearch/elasticsearch.yml saved as /etc/elasticsearch/elasticsearch.yml.rpmsave
[root@meg ELK]# rpm -ivh elasticsearch-
elasticsearch-1.4.0.noarch.rpm elasticsearch-head-master.zip
[root@meg ELK]# rpm -ivh jdk-
jdk-7u71-linux-x64.rpm jdk-8u31-linux-x64.rpm
[root@meg ELK]# rpm -ivh jdk-8u31-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk1.8.0_31 ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...
[root@meg ELK]# ja
jar java javac javadoc javaws
[root@meg ELK]# java -version
java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (rhel-1.13.5.0.el6_6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
[root@meg ELK]# ls -l /usr/share/java
java/ java-1.3.1/ java-1.4.0/ java-1.4.1/ java-1.4.2/ java-1.5.0/ java-1.6.0/ java-1.7.0/ javadoc/ java-ext/ java-utils/ javazi/
[root@meg ELK]# ls -l /usr/java/jdk1.7.0_71/
bin/ jre/ README.html THIRDPARTYLICENSEREADME.txt
COPYRIGHT lib/ release
db/ LICENSE src.zip
include/ man/ THIRDPARTYLICENSEREADME-JAVAFX.txt
[root@meg ELK]# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_71/bin/java 2
[root@meg ELK]# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/java/jdk1.7.0_71/bin/java
Enter to keep the current selection[+], or type selection number: 2
[root@meg ELK]# java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
[root@meg ELK]# rpm -ivh elasticsearch-
elasticsearch-1.4.0.noarch.rpm elasticsearch-head-master.zip
[root@meg ELK]# rpm -ivh elasticsearch-1.4.0.noarch.rpm
Preparing... ########################################### [100%]
1:elasticsearch ########################################### [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch to start automatically using chkconfig
sudo /sbin/chkconfig --add elasticsearch
### You can start elasticsearch by executing
sudo service elasticsearch start
[root@meg ELK]# vim /etc/elasticsearch/elasticsearch.yml
[root@meg ELK]# service elasticsearch start
Starting elasticsearch: [ OK ]
No comments:
Post a Comment