Elasticsearch Start up Problem

Hi, I recently installed Elasticsearch on my server - while starting I'm getting below exception:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 51.0

I've setup JDK1.8 and done everything required:

java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

echo $JAVA_HOME
/u01/apps/java/jdk1.8.0_60

Appreciate your help to resolve this issue please.

Thanks,
Ariv

Hello Arivazhagan,

Version 51.0 is java 7. So, this would happen if you are trying to run ES with java 6. Maybe you have a java 6 installation? If this is the case, then the elasticsearch startup script is picking up that version somehow...

Cheers

Hi Thiago, Thanks for your response.

I do have 3 versions Java 6, 7 and 8. I've set my JAVA_HOME to point to Java8, guess I have to try removing other two versions of the Java.

Again, does ES still run with Java 7???

Thanks

Hi Arivazhagan,

Yes, elasticsearch requires java 1.7u55+. Please, check the support matrix for more information https://www.elastic.co/support/matrix

Cheers

Hi,

I've moved the other Java installations but still i'm getting the above error.. :frowning:

Hello,

Did you "moved" or did you "removed"?

What is your OS? How did you installed ES?

Cheers

I moved to other location, but still the JAVA_HOME is pointing to JDK1.8

OS Version: 2.6.32-100.34.1.el6uek.x86_64 GNU/Linux

I downloaded ES latest version and unzipped and ran /bin/elasticsearch..

Even I created another thread for installation issue: ES Installation Problem

From my browser I tried launch: http://IP:9200 - is not working

By the way - I don't see any definitive guide installing ES on Linux, could you share if you have any (in fact I have to install full ELK stack)

There are several ways of installing/running ES in Linux.

If you want a more standard way, try using repositories: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html

Cheers

Thanks for spending time to reply my queries.

This the latest when I tried to install it again:

Package elasticsearch-1.3.9-1.noarch already installed and latest version
Nothing to do
[xxxxx@xxxxxxxx~]$ sudo service elasticsearch restart
[sudo] password for ecomm:
Stopping elasticsearch: [FAILED]
Starting elasticsearch: [ OK ]
[xxxxx@xxxxxxxx~]$ 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:634)
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:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.elasticsearch.bootstrap.Elasticsearch. Program will exit.

Run the following and paste the output here:

which java

/u01/apps/java/jdk1.8.0_60/bin/java

That's the correct one.

You could add the following to /etc/default/elasticsearch:

JAVA_HOME=/u01/apps/java/jdk1.8.0_60

If does not works, then one last shot is setting the above line as the first line in /etc/init.d/elasticsearch.

If even that does not works, then something else is causing elasticsearch init scripts to select the java 6 installation somehow.

Cheers

No luck, have tried all the step.

Do you suggest to "completely remove" other JDK versions and do a fresh ES installation?

Either that or maybe docker, are you familiar with docker?

Sorry, not heard about it..

See if you can follow this https://docs.docker.com/engine/installation/linux/oracle/

Then, if you can successfully install docker, then run elasticsearch with the following:

docker run -d --net host elasticsearch

Ok - will check and let you know. Thanks again