I can not install any LogStash plug-in in ES 5.0

Thanks @deanso for the hint.
Sadly there is no proxy involved, the box is directly connected to the internet via NAT.

just a longshot, but sure the plugin isn't already installed?
bin/logstash-plugin list --verbose | grep elasticsearch

Fresh install of 5.1.2 on an AWS instance and the same thing is happening to me

bin/logstash-plugin install logstash-filter-truncate

Validating logstash-filter-truncate
Installing logstash-filter-truncate
Error Bundler::InstallError, retrying 1/10
An error occurred while installing logstash-core-event-java (5.1.2), and Bundler cannot continue.
Make sure that gem install logstash-core-event-java -v '5.1.2' succeeds before bundling.

edit: It apparently got solved by letting it retry several times without touching anything

Confirmed, but it doesn't "work itself out" no matter how many retries.

What worked for me is removing the read-only flag from the entire LS folder (the folder was under a VS project and was protected with the flag)

I had the same issue, both on ES5.1 and on ES5.2, on macOS Sierra 10.12.3. I have been able to fix the issue by modifying ~/.bash_profile.

Reproducing the error
1. Try to install a plugin leading to an error:
./bin/logstash-plugin install logstash-filter-translate_

Validating logstash-filter-translate
Installing logstash-filter-translate
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Error Bundler::InstallError, retrying 1/10
An error occurred while installing logstash-core-event-java (5.2.0), and Bundler cannot continue.
Make sure that `gem install logstash-core-event-java -v '5.2.0'` succeeds before bundling.

2. Confirm that correct Java is installed
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)

3. Check JAVA HOME setting
echo $JAVA_HOME

The return was empty

Fixing the error
1. Add JAVA HOME to the bash profile
nano ~/.bash_profile
Add to the profile:
export JAVA_HOME=$(/usr/libexec/java_home)

2. Check JAVA HOME setting
echo $JAVA_HOME

Returning:

/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

3. Try install of a plugin
./bin/logstash-plugin install logstash-filter-translate

Returning:

Validating logstash-filter-translate
Installing logstash-filter-translate
Installation successful
1 Like

For those that are behind a proxy, you might want to try to add: -J-Dhttp.proxyHost=your.proxy.server -J-Dhttp.proxyPort=1234 to JRUBY_OPTS in logstash-plugin

That did the trick for me.

cat /usr/share/logstash/bin/logstash-plugin
#!/bin/sh

unset CDPATH
. "$(cd `dirname $0`/..; pwd)/bin/logstash.lib.sh"
setup

# bin/logstash-plugin is a short lived ruby script thus we can use aggressive "faster starting JRuby options"
# see https://github.com/jruby/jruby/wiki/Improving-startup-time
export JRUBY_OPTS="$JRUBY_OPTS -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -X-C -Xcompile.invokedynamic=false -J-Dhttp.proxyHost=your.proxy.server -J-Dhttp.proxyPort=1234"

ruby_exec "${LOGSTASH_HOME}/lib/pluginmanager/main.rb" "$@"