I am getting error while building my spring boot application. I am using ES and error comes while jestClient invokes execute method. Error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configService': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: io.searchbox.action.Action.getURI()Ljava/lang/String;
Error comes from the execute method of jestHttpClient.class
public <T extends JestResult> T execute(Action<T> clientRequest, RequestConfig requestConfig) throws IOException {
HttpUriRequest request = this.prepareRequest(clientRequest, requestConfig);
CloseableHttpResponse response = null;
JestResult var5;
try {
response = this.executeRequest(request);
var5 = this.deserializeResponse(response, request, clientRequest);
} catch (HttpHostConnectException var14) {
throw new CouldNotConnectException(var14.getHost().toURI(), var14);
} finally {
if (response != null) {
try {
response.close();
} catch (IOException var13) {
log.error("Exception occurred while closing response stream.", var13);
}
}
}
return var5;
}
This is a common error that happens when you compile a different version of the class that its being refered in the code. This can happen due you have the dependency imported twice.
For example you can manually import a dependency that contains io.searchbox.action.Action
but io.searchbox.action.Action
is also imported in a dependency inside another dependency whith another version.
Just take care about the version you are compiling because in Jest newest versions getURL is as follows
String getURI(ElasticsearchVersion elasticsearchVersion);
But on in 5.3.4 is as follows
String getURI();