'StackOverflowError exception. Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString()

ElasticSearchTemplate throws exception during initialization Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString().

XML config

<elasticsearch:transport-client id="client" cluster-nodes="localhost:9300" />

<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
    <constructor-arg name="client" ref="client"/>
</bean>

Does anyone know whats causing this issue. Elastic version 5.6.3 and 5.5.0 and Spring Data Elastic 3.0.1 and Not using SpringBoot

Now using: Elastic High Level Rest Client



Solution 1:[1]

When Running With Debugger i also got the same issue. but the client is creating and it haven't causes any issues for me. more info is here

https://discuss.elastic.co/t/cannot-evaluate-org-elasticsearch-common-inject-injectorimpl-tostring/156014/3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Indika_Nuwan95