Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cfedericovonwernich opened this issue Apr 14, 2025 · 0 comments
Labels
Area: Helpers Category: Bug Something isn't working

Comments

@cfedericovonwernich
Copy link

cfedericovonwernich commented Apr 14, 2025

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?

@l-trotta l-trotta added Category: Bug Something isn't working Area: Helpers labels Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Helpers Category: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants