# Elasticsearch configuration is Failing

**URL:** <https://discuss.elastic.co/t/elasticsearch-configuration-is-failing/246863>\
**Category:** Elasticsearch\
**Created:** [August 30, 2020, 5:01am UTC](https://discuss.elastic.co/t/elasticsearch-configuration-is-failing/246863 "2020-08-30T05:01:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinit\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinit_kumar/32/74784_2.png) [@Vinit\_Kumar](https://discuss.elastic.co/u/Vinit_Kumar)\
**Post date:** [August 30, 2020, 5:01am UTC](https://discuss.elastic.co/t/elasticsearch-configuration-is-failing/246863/1 "2020-08-30T05:01:15Z")

</div>

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:**

```auto
restHighLevelClient.fetchUnProcessedDocuments()

```

below is my RestHighLevelClient bean:

```auto
@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.

---

<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:** [September 27, 2020, 5:01am UTC](https://discuss.elastic.co/t/elasticsearch-configuration-is-failing/246863/2 "2020-09-27T05:01:16Z")

</div>

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