# Connection Error from Java client

**URL:** <https://discuss.elastic.co/t/connection-error-from-java-client/88923>\
**Category:** Elasticsearch\
**Created:** [June 10, 2017, 7:13pm UTC](https://discuss.elastic.co/t/connection-error-from-java-client/88923 "2017-06-10T19:13:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpardi](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@jpardi](https://discuss.elastic.co/u/jpardi)\
**Post date:** [June 10, 2017, 7:13pm UTC](https://discuss.elastic.co/t/connection-error-from-java-client/88923/1 "2017-06-10T19:13:47Z")

</div>

Config:

- Ubuntu host running ES 5.3.2 in docker container. Ports 9200 and 9300 exposed.
- using Spring Boot Data (Java) as the client, running on the Ubuntu host
- from host, telnet to port 9200 works fine
- from host, curl to [http://127.0.0.1:9200](http://127.0.0.1:9200) works fine

When the Java client tries to connect, I get the following error:

> org.elasticsearch.transport.netty : [Patriot II] connected to node [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]  
> org.elasticsearch.transport.netty : [Patriot II] disconnecting from [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}], ClosedChannelException[null]  
> org.elasticsearch.client.transport : [Patriot II] failed to get node info for {#transport#-1}{127.0.0.1}{127.0.0.1:9300}, disconnecting...  
> .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]

My client settings:

> client.transport.sniff = false  
> client.type = transport  
> cluster.name = docker-cluster  
> name = Patriot II  
> network.server = false  
> node.client = true  
> transport.ping\_schedule = 5s

When I curl the ES container's health, it reports

> 1497121581 19:06:21 docker-cluster yellow 1 1 2 2 0 0 2 0 - 50.0%

When I look at the ES log within the container, there are two lines that catch my eye:

> Failed to find a usable hardware address from the network interfaces; using random bytes: b3:5d:58:99:29:27:04:6a  
> ...  
> Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[.monitoring-es-2-2017.06.10][0]] ...])

Note that I already ran sysctl -w vm.max\_map\_count=262144 on the host.

My Java code looks like this:

> ```
> Settings esSettings = Settings.settingsBuilder()
> .put("cluster.name", EsClusterName)
> .put("client.transport.sniff", false)
> .put("node.client", true)
> .build();
> 
> ```

> ```
> return TransportClient.builder()
> .settings(esSettings)
> .build()
> .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(EsHost), EsPort));
> 
> ```

Any ideas? I'm out of ideas ...

- Joe

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 10, 2017, 8:05pm UTC](https://discuss.elastic.co/t/connection-error-from-java-client/88923/2 "2017-06-10T20:05:58Z")

</div>

May be you are using an old client version ?

Have a look at [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html)

---

<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:** [July 8, 2017, 8:06pm UTC](https://discuss.elastic.co/t/connection-error-from-java-client/88923/3 "2017-07-08T20:06:37Z")

</div>

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