Hi All,
I’m new to Camunda, doing POC on different workflow tools and I found one issue while deploying simple war in Camunda application server. I have given error details below
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.fetchEmployees();
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.