Logstash java link error

I encounter a problem starting logstash.

Uncompressing 6.X.tar.gz (i.e not only the last 6.2.4 version of logstash) I have the following error message:

[ERROR] 2018-05-29 15:45:29.898 [main] Logstash - java.lang.IllegalStateException: org.jruby.exceptions.RaiseException: (NameError) cannot link Java class org.apache.http.client.methods.HttpRequestBase, probable missing dependency: org/apache/http/HttpRequest

Is there someone to explain this error ?
For instance, I tryed to put the httpclient-4.0.2 or httpclient-4.5.2 in the logstash-core/lib/jars directory without any result...

Thanks

Found a workaround:

cp ~/.m2/repository/org/apache/httpcomponents/httpcore/4.4.8/httpcore-4.4.8.jar ~/elastic-stack/logstash-6.2.4/logstash-core/lib/jars/

and

cp ~/.m2/repository/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar ~/elastic-stack/logstash-6.2.4/logstash-core/lib/jars/

But it is stange to need that...
Is tar.gz build differently from linux packages on that point ?

Not sufficient further usage of logstash is missing dependencies ...

error extract:
last error: cannot load Java class org.apache.http.client.utils.SSLConnectionSocketFactory

I think it is a packaging bug ...

Which version of Java are you using? Which operating system?

jdk:

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

Système

Linux MachineName 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Please note the error is more detailed on 6.0.0:

NameError: cannot load Java class org.apache.http.client.methods.HttpRequestBase
for_name at org/jruby/javasupport/JavaClass.java:286
get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
block in java_import at uri:classloader:/jruby/java/core_ext/object.rb:49
map at org/jruby/RubyArray.java:2486
java_import at uri:classloader:/jruby/java/core_ext/object.rb:36
at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.1-java/lib/manticore/java_extensions.rb:1
require at org/jruby/RubyKernel.java:955
(root) at uri:classloader:/jruby/kernel/kernel.rb:1
module:require_relative at uri:classloader:/jruby/kernel/kernel.rb:13
at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.1-java/lib/manticore.rb:44
require at org/jruby/RubyKernel.java:955
require at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65
at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/manticore-0.6.1-java/lib/manticore.rb:14
require at org/jruby/RubyKernel.java:955
require at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65
at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/elasticsearch-transport-5.0.4/lib/elasticsearch/transport/transport/http/manticore.rb:1
require at org/jruby/RubyKernel.java:955
require at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65
at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/elasticsearch-transport-5.0.4/lib/elasticsearch/transport/transport/http/manticore.rb:1
require at org/jruby/RubyKernel.java:955
require at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65
at /home/tony/Documents/temporaire/logstash-6.0.0/logstash-core/lib/logstash/elasticsearch_client.rb:1
require at org/jruby/RubyKernel.java:955
require at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65
at /home/tony/Documents/temporaire/logstash-6.0.0/logstash-core/lib/logstash/elasticsearch_client.rb:5
require at org/jruby/RubyKernel.java:955
require at /home/tony/Documents/temporaire/logstash-6.0.0/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65
at /home/tony/Documents/temporaire/logstash-6.0.0/logstash-core/lib/logstash/config/modules_common.rb:1
require at org/jruby/RubyKernel.java:955
at /home/tony/Documents/temporaire/logstash-6.0.0/logstash-core/lib/logstash/config/modules_common.rb:3
require at org/jruby/RubyKernel.java:955
at /home/tony/Documents/temporaire/logstash-6.0.0/lib/bootstrap/environment.rb:70

Thanks for your help :wink:

Found the problem with a real chance doing really something else than palying with logstash !

When I was building a maven project, I found a very strange error message saying:

[ERROR] error reading /home/user/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar; error in opening zip file

So I tryed to rm the bad jar file and then thought to launch logstash again to see what would happen ...

And logstash worked ???

Then I grepped the logstash dir to find that some scripts refering to .m2 ???

vendor/bundle/jruby/2.3.0/gems/jar-dependencies-0.3.11/lib/jars/maven_settings.rb: settings = File.join( Jars.user_home, '.m2', 'settings.xml' )

Logsatsh seems to use .m2 in its path and then override the httpclient jar shipped with logstash manticore-0.6.1-java/lib...

I think this discovery is very puzzling ...
Is it safe to do that ?

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