Skip to content

Elasticsearch API client version 8.16.1 does not fully support Java 8 #995

Closed
@cfedericovonwernich

Description

@cfedericovonwernich

Java API client version

8.16.1

Java version

8.0.422-amzn

Elasticsearch Version

8.4.3

Problem description

When trying to use above configuration AND enabling capturing of search request bodies: https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/opentelemetry.html#_capture_search_request_bodies

Then you get the following exception:

[358DC105] java.lang.NoSuchMethodError: java.nio.ByteBuffer.mark()Ljava/nio/ByteBuffer;
	at co.elastic.clients.transport.instrumentation.OpenTelemetryForElasticsearch$OTelContext.beforeSendingHttpRequest(OpenTelemetryForElasticsearch.java:221)
	at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:143)
	at co.elastic.clients.elasticsearch.ElasticsearchClient.search(ElasticsearchClient.java:2317)

What seems to be happening:

In Java 8, mark() implementation is inherited from java.nio.Buffer, and it seems on higher versions, java.nio.ByteBuffer has its own implementation of mark method. When compiling this code using the compiler of a higher Java version targeting 1.8, then we get this issue.

https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/ This resource was quite helpful understanding the issue.

The signature we have available using version 8.0.422-amzn is: java.nio.Buffer.mark()Ljava/nio/Buffer; instead of what the library is expecting: java.nio.ByteBuffer.mark()Ljava/nio/ByteBuffer;

Can we get an oficial release using the Java 8 compiler?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions