Error nested exception is java.lang.NoSuchMethodError:

Hi guys,
I'm using spring boot 2.1.1 connect to Elasticsearch 7.3.4 (elastic was run on docker).
Spring application startup and connected to the Elasticsearch but when I try to search may document on Elastic I got the error:

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError:

My Search query like below:

NativeSearchQuery build = new NativeSearchQueryBuilder()
                .withPageable(new PageRequest(0, 10))
        List<FullProfile> articles = elasticsearchTemplate.queryForList(build,FullProfile.class);

Can you guys help me to resolve this problem.


providing the full exception would help.

Is it possible, that you are using a newer/older Elasticsearch dependency, that Spring Boot is using/requiring? Are you overriding dependencies somewhere?


When using springboot with
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your pom.xml:


See documentation here:

Yes I already tried with version 7.3.4 in my pom.xml file before I bring my problem to here.
But I still got error.
Currently I switch to Elasticsearch 6.6.2 and anything work great.
Of course I also have to specify elastic version in pom.xml.
Later on I will try with version 7.3.4 again.
Anyway thanks for your answer.

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