Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString()

I want to create a es client but I got a error like this:
Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString()

This is my code:

    Settings settings = Settings.builder()
                .put("cluster.name", this.esName)
                .put("client.transport.sniff", true)
                .build();
    TransportClient = new PreBuiltTransportClient(settings);
    client.addTransportAddress(TransportAddress(new InetSocketAddress(InetAddresses.forString("163.2.4.56"),9300)));

Does anybody know the reason?

Do you have a full stacktrace available and can share it? Where in the execution of the code above do you see this being triggered?

I don't have full stacktrace because it doesn't influence the use and the exception message didn't show in the console.
It was like this:

The problem only seems to be happening when the debugger tries to print the "InjectorImpl" class, seem like there is some cyclic references in the internal State that cause "toString" to go into a loop:

java.lang.StackOverflowError
	[...]
	at org.elasticsearch.common.inject.InjectorImpl.toString(InjectorImpl.java:831)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractMap.toString(AbstractMap.java:559)
	at org.elasticsearch.common.inject.internal.ToStringBuilder.toString(ToStringBuilder.java:51)
	at org.elasticsearch.common.inject.internal.InstanceBindingImpl.toString(InstanceBindingImpl.java:107)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at java.util.Collections$UnmodifiableCollection.toString(Collections.java:1035)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractMap.toString(AbstractMap.java:559)
	at org.elasticsearch.common.inject.internal.ToStringBuilder.toString(ToStringBuilder.java:51)
	at org.elasticsearch.common.inject.InjectorImpl.toString(InjectorImpl.java:831)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractMap.toString(AbstractMap.java:559)
	at org.elasticsearch.common.inject.internal.ToStringBuilder.toString(ToStringBuilder.java:51)
	at org.elasticsearch.common.inject.internal.InstanceBindingImpl.toString(InstanceBindingImpl.java:107)

This shouldn't cause any real problems with Elasticsearch, or do you experience any issues?

It didn't cause any problem in the using of client. I just wanted to check if the client had been created successfully and I saw the exception in the debugger.

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