Exception in thread “main” java.lang.UnsupportedClassVersionError: org/elasticsearch/plugins/PluginCli : Unsupported major.minor version 52.0

The aws ec2-instance has older version has Java 1.7. The latest version of the elastic-search requires Java 1.8. If you try to install the plugin like x-pack now, you will get this error:

[ec2-user@ip-10-0-20-199 bin]$ sudo ./elasticsearch-plugin install x-pack[ec2-user@ip-10-0-20-199 bin]$ sudo ./elasticsearch-plugin install x-packException in thread “main” java.lang.UnsupportedClassVersionError: org/elasticsearch/plugins/PluginCli : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:803) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) at java.net.URLClassLoader.access$100(URLClassLoader.java:64) at java.net.URLClassLoader$1.run(URLClassLoader.java:354) at java.net.URLClassLoader$1.run(URLClassLoader.java:348) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:347) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)[ec2-user@ip-10-0-20-199 bin]$ packet_write_wait: Connection to 35.154.108.46 port 22: Broken pipe

The fix is simple, update the Java version to 1.8.

This how we do it on aws ec2 instance:

[ec2-user@ip-10-0-20-199 ~]$ sudo yum install java-1.8.0
[ec2-user@ip-10-0-20-199 ~]$ sudo /usr/sbin/alternatives –config java
[ec2-user@ip-10-0-20-199 ~]$ sudo /usr/sbin/alternatives –config java

There are 2 programs which provide ‘java’.

Selection Command
———————————————–
*+ 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 2

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s