LambdaConversionException Invalid receiver type interface org.apache.http.Header -from RestHighLevelClient in Logstash Java plugin

My RestHighLevelClient can run well in Win10 IDEA enviroment for testing, but when I "gradlew gem" the gem package, and run it in CentOS8 logstash-plugin enviroment(Logstash 7.9.0), there
will be:

[2020-11-10T00:09:04,077][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
warning: thread "[main]>worker1" terminated with exception (report_on_exception is true):
java.lang.BootstrapMethodError: bootstrap method initialization exception
at java.lang.invoke.BootstrapMethodInvoker.invoke(java/lang/invoke/BootstrapMethodInvoker.java:194)
at java.lang.invoke.CallSite.makeSite(java/lang/invoke/CallSite.java:315)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(java/lang/invoke/MethodHandleNatives.java:259)
at java.lang.invoke.MethodHandleNatives.linkCallSite(java/lang/invoke/MethodHandleNatives.java:249)
at org.elasticsearch.client.RestClient.convertResponse(org/elasticsearch/client/RestClient.java:288)
at org.elasticsearch.client.RestClient.performRequest(org/elasticsearch/client/RestClient.java:272)
at org.elasticsearch.client.RestClient.performRequest(org/elasticsearch/client/RestClient.java:246)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(org/elasticsearch/client/RestHighLevelClient.java:1613)
at org.elasticsearch.client.RestHighLevelClient.performRequest(org/elasticsearch/client/RestHighLevelClient.java:1583)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(org/elasticsearch/client/RestHighLevelClient.java:1553)
at org.elasticsearch.client.RestHighLevelClient.bulk(org/elasticsearch/client/RestHighLevelClient.java:533)
at org.logstashplugins.OutputLogstashPlugin.bulkWriteES(org/logstashplugins/OutputLogstashPlugin.java:75)
at org.logstashplugins.OutputLogstashPlugin.process(org/logstashplugins/OutputLogstashPlugin.java:617)
at org.logstashplugins.JavaOutputExample.output(org/logstashplugins/JavaOutputExample.java:104)
at org.logstash.config.ir.compiler.JavaOutputDelegatorExt.outputRubyEvents(org/logstash/config/ir/compiler/JavaOutputDelegatorExt.java:92)
at org.logstash.config.ir.compiler.JavaOutputDelegatorExt.doOutput(org/logstash/config/ir/compiler/JavaOutputDelegatorExt.java:115)
at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multi_receive(org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:121)
at org.logstash.generated.CompiledDataset1.compute(org/logstash/generated/CompiledDataset1)
at org.logstash.config.ir.CompiledPipeline$CompiledUnorderedExecution.compute(org/logstash/config/ir/CompiledPipeline.java:343)
at org.logstash.config.ir.CompiledPipeline$CompiledUnorderedExecution.compute(org/logstash/config/ir/CompiledPipeline.java:333)
at org.logstash.execution.WorkerLoop.run(org/logstash/execution/WorkerLoop.java:83)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:564)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:426)
at org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:293)
at usr.local.logstash.logstash_minus_core.lib.logstash.java_pipeline.start_workers(/usr/local/logstash/logstash-core/lib/logstash/java_pipeline.rb:293)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:318)
at java.lang.Thread.run(java/lang/Thread.java:832)
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair
at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:254)
at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:327)
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:127)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:315)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:259)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:249)
at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:288)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:272)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:246)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1613)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1583)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1553)
at org.elasticsearch.client.RestHighLevelClient.bulk(RestHighLevelClient.java:533)
at org.logstashplugins.OutputLogstashPlugin.bulkWriteES(OutputLogstashPlugin.java:75)
at org.logstashplugins.OutputLogstashPlugin.process(OutputLogstashPlugin.java:617)
at org.logstashplugins.JavaOutputExample.output(JavaOutputExample.java:104)
at org.logstash.config.ir.compiler.JavaOutputDelegatorExt.outputRubyEvents(JavaOutputDelegatorExt.java:92)
at org.logstash.config.ir.compiler.JavaOutputDelegatorExt.doOutput(JavaOutputDelegatorExt.java:115)
at org.logstash.config.ir.compiler.AbstractOutputDelegatorExt.multiReceive(AbstractOutputDelegatorExt.java:121)
at org.logstash.generated.CompiledDataset1.compute(Unknown Source)
at org.logstash.config.ir.CompiledPipeline$CompiledUnorderedExecution.compute(CompiledPipeline.java:343)
at org.logstash.config.ir.CompiledPipeline$CompiledUnorderedExecution.compute(CompiledPipeline.java:333)
at org.logstash.execution.WorkerLoop.run(WorkerLoop.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

The CentOS 8 jvm enviroment version is jdk 11, the same as the IDEA win10 enviroment. There is no http httpcore.jar class path issue. httpclient is in the httpasyncclient-4.1.4.jar' related version like below:

compile fileTree(dir: 'D:\project\logELK\logstash-output-java_output_example\locallib\httpclient', include: 'httpasyncclient-4.1.4.jar')
compile fileTree(dir: 'D:\project\logELK\logstash-output-java_output_example\locallib\httpclient', include: 'httpclient-4.5.6.jar')
compile fileTree(dir: 'D:\project\logELK\logstash-output-java_output_example\locallib\httpclient', include: 'httpcore-4.4.10.jar')
compile fileTree(dir: 'D:\project\logELK\logstash-output-java_output_example\locallib\httpclient', include: 'httpcore-nio-4.4.10.jar')

I've searched the logstash project, there is no httpclient reference or its related dependencies. Logstash uses jruby code to do http thing by its own http_client.rb.
The deprecated Jest Client can be used in CentOS 8 logstash Java plugin enviroment, but I am still struggling to find the Bulk Json insertion solution in Jest Client.
Could some expert give me some advices? Thanks!

Welcome!

What exactly are you doing and why?

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

I am using the </> button for just serveral sentences' formatting but failed :rofl: Or I have to use markdown editor?

I've post the my question by markdown format but also failed. Does the notice above tell me to use ' key replace the return key?

You can copy paste the exact characters to use. Note that it's not '.

```
CODE
```

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