# NoNodeAvailableException when connecting from Java

**URL:** <https://discuss.elastic.co/t/nonodeavailableexception-when-connecting-from-java/56456>\
**Category:** Elasticsearch\
**Created:** [July 26, 2016, 10:07pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-when-connecting-from-java/56456 "2016-07-26T22:07:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanBlum](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@DanBlum](https://discuss.elastic.co/u/DanBlum)\
**Post date:** [July 26, 2016, 10:07pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-when-connecting-from-java/56456/1 "2016-07-26T22:07:19Z")

</div>

We have a 2.3.3 cluster which works fine from Python. I need to connect to it from Java but am clearly doing something wrong. My code to create the client is

```
    Settings settings = Settings.settingsBuilder().put("client.transport.sniff", true).put("cluster.name", "foo").build();
    Client client = new TransportClient.Builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("host", 9300)));

```

The host name is correct and "foo" is configured as the cluster name in the yml. When I try to do anything with the Client object I get

```
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{1.2.3.4}{host/1.2.3.4:9300}]]
        at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)

```

The actual IP address in the error is correct, as is the host name.

I saw some StackOverflow posts which suggested adding network:publish\_host and network:bind\_host lines to the yml - they had no effect.

The ES log says

`[transport] [foo-1] publish_address {host/1.2.3.4:9300}, bound_addresses {1.2.3.4:9300}`

Any ideas?

---

<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:** [July 26, 2016, 10:40pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-when-connecting-from-java/56456/2 "2016-07-26T22:40:00Z")

</div>

May be a firewall issue?  
Can you telnet on port 9300 from the machine where the Java client runs?

---

<div class="post-metadata">

**Author:** ![DanBlum](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@DanBlum](https://discuss.elastic.co/u/DanBlum)\
**Post date:** [July 27, 2016, 2:24pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-when-connecting-from-java/56456/3 "2016-07-27T14:24:00Z")

</div>

It was not supposed to be blocked, but apparently it is. That was simple. Thanks!

---

<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 5, 2017, 10:32pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-when-connecting-from-java/56456/4 "2017-07-05T22:32:29Z")

</div>


