Elasticsearch configuration is Failing

Hi all,

Need your help.

I have integrated Camunda BPM in my spring boot application with MySQL (to store Camunda varibales and data) and elasticsearch (to store real business application data), and it was working file.

Now I have decouple the camunda server from spring boot application and deploying spring boot application through Camunda inbuilt Apache Tomcat server which is throwing NullPointerException in RestHighLevelClient

In Below line restHighLevelClient is reference of RestHighLevelClient which is throwing NPE:

restHighLevelClient.fetchUnProcessedDocuments()

below is my RestHighLevelClient bean:

@Bean
public RestHighLevelClient getRestHighLevelClient() {

    HttpHost[] httpHost = {new HttpHost("localhost", 9200, "http")};
    RestClientBuilder restClient = RestClient.builder(httpHost);

    final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
    credentialsProvider.setCredentials(AuthScope.ANY,
            new UsernamePasswordCredentials("elastic", "test"));

    restClient.setHttpClientConfigCallback(httpClientBuilder -> {
         httpClientBuilder.disableAuthCaching();
        return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
    });

    return new RestHighLevelClient(restClient);
}

And I have added @Configuration annotation on top of configuration class.

Need you expertise advice to fix this issue. Thanks in advance.

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