NoSuchMethodError CharBuffer.flip() using java 8 with spring boot and APM 1.0.0


(Jettro Coenradie) #1

Hi I want to play around with APM and used a spring boot application to play around. However, I get this exception. I am running on a mac with jdk 8. Any idea what I am doing wrong?

java.lang.NoSuchMethodError: java.nio.CharBuffer.flip()Ljava/nio/CharBuffer;
	at co.elastic.apm.util.IOUtils.readUtf8Stream(IOUtils.java:84) ~[?:?]
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:232) ~[elasticsearch-rest-client-6.3.0.jar:6.3.0]
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:198) ~[elasticsearch-rest-client-6.3.0.jar:6.3.0]
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:522) ~[elasticsearch-rest-high-level-client-6.3.0.jar:6.3.0]
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:508) ~[elasticsearch-rest-high-level-client-6.3.0.jar:6.3.0]

(Felix Barnsteiner) #2

Hi and thanks a lot for reporting this.

That's a very strange one. In Java 9, CharBuffer overrides the Buffer#flip method which returns a CharBuffer. In Java 8, it does override the method but the method still exists in the superclass Buffer but that one has a different return type than the class it was compiled against.

Long story short, I'll do a bugfix release shortly and sorry for the inconvenience.

Cheers,
Felix


(Felix Barnsteiner) #3

To fix the error right now, you can disable the elasticsearch-restclient instrumentation: https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-disable-instrumentations


(Felix Barnsteiner) #4

The fix is implemented: https://github.com/elastic/apm-agent-java/pull/313


(Jettro Coenradie) #5

Thanks for your fast response, will try your suggestion.


(Felix Barnsteiner) #6

I have release 1.0.1 which fixes this issue. Thanks a lot for reporting and keep up the feedback :slight_smile:


(system) #7

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