reactiverse / elasticsearch-client

This client exposes the Elasticsearch Java High Level REST Client for Eclipse Vert.x applications.
Apache License 2.0
39 stars 9 forks source link

Got exception "Invalid receiver type interface org.apache.http.Header ...." #12

Open Nossiac opened 3 years ago

Nossiac commented 3 years ago

Since vertx.io does not provide any official elasticsearch wrapper, then I come to this lib. I'm currently testing 0.9.0-ec7.10.1 with vertx-4.1.1, JDK 1.8.

Here's my testing,

   void TestEs(Vertx vertx, VertxTestContext testContext) {
        RestClientBuilder builder = RestClient.builder(new HttpHost("xxxxxx",));
        RestHighLevelClient client = RestHighLevelClient.create(vertx, builder);

        GetAsyncSearchRequest var1 = new GetAsyncSearchRequest("event");
        RequestOptions var2 = RequestOptions.DEFAULT;
        client.asyncSearch().getAsync(var1, var2,  res -> {
            if (res.failed()) {
                testContext.failNow(res.cause());
            } else {
                System.out.println(res);
                testContext.completeNow();
            }
        });
    }

It gave me exceptions as below:

org.apache.http.nio.reactor.IOReactorException: I/O dispatch worker terminated abnormally
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:359)
    at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
    at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)
    at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:312)
    at org.elasticsearch.client.RestClient.access$1800(RestClient.java:105)
    at org.elasticsearch.client.RestClient$1.completed(RestClient.java:374)
    at org.elasticsearch.client.RestClient$1.completed(RestClient.java:370)
    at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:181)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
    at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
    ... 1 more
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:328)
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:127)
    ... 22 more

Similar error was found at stackoverflow-33929304 and stackoverflow-33925551.

Did I make any mistake? Or it's indeed a compiler bug? any workaround solution?

mshah-sc commented 5 months ago

@Nossiac Did you find any solution to this issue. I'm getting the same error with opensearch client version 1.2.4