Logstash.runner Fatal error TypeError: illegal access on 'getThreadCount'


(Sujal Patel) #1

I am running LogStash for very first time. So I have no idea what's going on. Please help someone. I appreciate it in advance. Thank you.

[2018-01-23T05:04:22,719][FATAL][logstash.runner ] An unexpected error occurred! {:error=>#<TypeError: illegal access on 'getThreadCount': class org.jruby.javasupport.JavaMethod cannot access class sun.management.ThreadImpl (in module java.management) because module java.management does not export sun.management to unnamed module @4d3167f4>, :backtrace=>["/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb:80:incollect_threads_metrics'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb:57:in collect'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/instrument/periodic_poller/base.rb:57:instart'", "org/jruby/RubyArray.java:2486:in map'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/instrument/periodic_pollers.rb:23:instart'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/agent.rb:419:in configure_metrics_collectors'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/agent.rb:67:ininitialize'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/runner.rb:422:in create_agent'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/runner.rb:333:inexecute'", "/home/sujal/logstash-6.1.2/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in run'", "/home/sujal/logstash-6.1.2/logstash-core/lib/logstash/runner.rb:214:inrun'", "/home/sujal/logstash-6.1.2/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:in run'", "/home/sujal/logstash-6.1.2/lib/bootstrap/environment.rb:67:in'"]}`


(Robert) #2

I'm having the same problem. Just installed on Linux (Linux Mint)

[2018-01-29T13:38:25,078][FATAL][logstash.runner ] An unexpected error occurred! {:error=>#<TypeError: illegal access on 'getThreadCount': class org.jruby.javasupport.JavaMethod cannot access class sun.management.ThreadImpl (in module java.management) because module java.management does not export sun.management to unnamed module @cb0ed20>, :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb:80:in collect_threads_metrics'", "/usr/share/logstash/logstash-core/lib/logstash/instrument/periodic_poller/jvm.rb:57:incollect'", "/usr/share/logstash/logstash-core/lib/logstash/instrument/periodic_poller/base.rb:57:in start'", "org/jruby/RubyArray.java:2486:inmap'", "/usr/share/logstash/logstash-core/lib/logstash/instrument/periodic_pollers.rb:23:in start'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:419:inconfigure_metrics_collectors'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:67:in initialize'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:422:increate_agent'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:333:in execute'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:inrun'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:214:in run'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:inrun'", "/usr/share/logstash/lib/bootstrap/environment.rb:67:in `'"]}


(Robert) #3

This was the problem ..... "Logstash requires Java 8. Java 9 is not supported."

installed java8:
apt install openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk

then checked what I had installed:
update-java-alternatives --list

then set the default to java8:
update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64


(Sujal Patel) #4

Thanks Robert for pointing this out!

I actually found somewhere that Logstash doesn't work with JDK9 yet. So I downgraded it and it has been working since then.

Thanks anyway. It's the solution indeed.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.