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

**URL:** <https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870>\
**Category:** APM\
**Created:** [November 15, 2018, 1:20pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870 "2018-11-15T13:20:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jettro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jettro/32/3418_2.png) [@jettro](https://discuss.elastic.co/u/jettro)\
**Post date:** [November 15, 2018, 1:20pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/1 "2018-11-15T13:20:40Z")

</div>

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]
```

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [November 15, 2018, 2:06pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/2 "2018-11-15T14:06:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [November 15, 2018, 2:10pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/3 "2018-11-15T14:10:20Z")

</div>

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](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-disable-instrumentations)

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [November 15, 2018, 2:36pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/4 "2018-11-15T14:36:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jettro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jettro/32/3418_2.png) [@jettro](https://discuss.elastic.co/u/jettro)\
**Post date:** [November 15, 2018, 2:36pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/5 "2018-11-15T14:36:53Z")

</div>

Thanks for your fast response, will try your suggestion.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [November 15, 2018, 5:35pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/6 "2018-11-15T17:35:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 6, 2018, 1:35pm UTC](https://discuss.elastic.co/t/nosuchmethoderror-charbuffer-flip-using-java-8-with-spring-boot-and-apm-1-0-0/156870/7 "2018-12-06T13:35:32Z")

</div>

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