# NoNodeAvailableException - Java API

**URL:** https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313
**Category:** Elasticsearch
**Created:** [November 11, 2015, 10:31am UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313 "2015-11-11T10:31:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Carlos\_Vega\_Moreno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_vega_moreno/32/3773_2.png) [@Carlos\_Vega\_Moreno](https://discuss.elastic.co/u/Carlos_Vega_Moreno)
#### Post date: [November 11, 2015, 10:31am UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/1 "2015-11-11T10:31:02Z")

</div>

After connecting to the elasticsearch cluster through the Java API

> 2015-11-11 11:04:36.987 Getting ES Client...  
> Nov 11, 2015 11:04:37 AM org.elasticsearch.plugins.PluginsService   
> INFO: [Elfqueen] loaded , sites   
> 2015-11-11 11:04:36.987 Node: xxx.xxx.xxx.xxx  
> 2015-11-11 11:04:36.987 ES Client obtained

I'm not able to create a new mapping in the cluster because I get this error on the last line of this piece of code:

```
CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(indexName);
createIndexRequestBuilder.addMapping(documentName, json);
createIndexRequestBuilder.execute().actionGet();

```

> Exception in thread "Thread-1" NoNodeAvailableException[None of the configured nodes are available:]  
> at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:280)  
> at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)  
> at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)  
> at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:272)  
> at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)  
> at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1177)  
> at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)  
> at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)

Is the same code that I used with previous versions of the Java API but I didn't get any errors then. I get the ES client with this code:

```
private static Client getClient() {  
        Settings settings = Settings.settingsBuilder().build();
        Client client = null;
        TransportClient transportClient = TransportClient.builder().settings(settings).build();

        try {
            client = transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(Receptor.es_ip), 9300));
        } catch (UnknownHostException e) {
            System.err.println(Util.getTimestampStr() + "UnknownHostException error.");
            e.printStackTrace();
        }

        if(transportClient.connectedNodes() == null){
            System.err.println(Util.getTimestampStr() + "No connected nodes found.");
        }else{
            for(DiscoveryNode d : transportClient.connectedNodes()){
                System.err.println(Util.getTimestampStr() + "DiscoveryNode: " + d.getHostName());
            }
            for(DiscoveryNode d : transportClient.listedNodes()){
                System.err.println(Util.getTimestampStr() + "Node: " + d.getHostName());
            }
        }
    
        return transportClient;
    }

```

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [November 11, 2015, 12:50pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/2 "2015-11-11T12:50:53Z")

</div>

You use empty settings for TransportClient, but you should declare at least the `cluster.name` you want to connect to, if your cluster name is not `elasticsearch`.

[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: ![Carlos\_Vega\_Moreno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_vega_moreno/32/3773_2.png) [@Carlos\_Vega\_Moreno](https://discuss.elastic.co/u/Carlos_Vega_Moreno)
#### Post date: [November 11, 2015, 2:40pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/3 "2015-11-11T14:40:45Z")

</div>

It doesn't matter, I get the same error, I added the cluster line to the getClient() method and I get the error anyway.

```
...
Settings settings = Settings.settingsBuilder().put("cluster.name", Receptor.clusterName).build();
Client client = null;
TransportClient transportClient = TransportClient.builder().settings(settings).build();
...
```

---

<div class="post-metadata">

### Author: ![Carlos\_Vega\_Moreno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_vega_moreno/32/3773_2.png) [@Carlos\_Vega\_Moreno](https://discuss.elastic.co/u/Carlos_Vega_Moreno)
#### Post date: [November 13, 2015, 11:25am UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/4 "2015-11-13T11:25:12Z")

</div>

I keep getting the same error. This happen to me since I use elasticsearch 2 and the correspondent Java API for ES 2.

---

<div class="post-metadata">

### Author: ![Manishanker](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Manishanker](https://discuss.elastic.co/u/Manishanker)
#### Post date: [November 13, 2015, 12:26pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/5 "2015-11-13T12:26:06Z")

</div>

Hi,

I am trying for Nutch 2.3 + ES 2.0 integration. I am not able to index the data fetched from the nutch. I am also facing the same exception.

java.lang.Exception: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []

My nutch-site.xml conf :

 storage.data.store.class org.apache.gora.mongodb.store.MongoStore Default class for storing data http.agent.name Crawler plugin.includes protocol-(http|httpclient)|urlfilter-regex|index-(basic|more)|query-(basic|site|url|lang)|indexer-elastic|nutch-extensionpoints|parse-(text|html|msexcel|msword|mspowerpoint|pdf)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)|parse-(html|tika|metatags)|index-(basic|anchor|more|metadata) elastic.host 192.168.2.a elastic.cluster uips\_cluster elastic.index nutch parser.character.encoding.default utf-8 http.content.limit 6553600 

I have set up ES 2.0 cluster as 1 master 2 nodes with master at 192.168.2.a

Can anyone help me how to resolve this ?

thanks  
Manishanker

---

<div class="post-metadata">

### Author: ![Carlos\_Vega\_Moreno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_vega_moreno/32/3773_2.png) [@Carlos\_Vega\_Moreno](https://discuss.elastic.co/u/Carlos_Vega_Moreno)
#### Post date: [November 13, 2015, 5:15pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/6 "2015-11-13T17:15:27Z")

</div>

This problem is a really big one and I would expect more attention to it 😕  
My Java program was working perfectly with previous versions of ES.

---

<div class="post-metadata">

### Author: ![Carlos\_Vega\_Moreno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_vega_moreno/32/3773_2.png) [@Carlos\_Vega\_Moreno](https://discuss.elastic.co/u/Carlos_Vega_Moreno)
#### Post date: [November 23, 2015, 4:25pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/7 "2015-11-23T16:25:05Z")

</div>

I found the solution [when I asked in Stackoverflow](http://stackoverflow.com/q/33691858/1051765):

The solution was as straightforward as:

`network.bind_host: 0`

[I found it here](http://stackoverflow.com/questions/33412549/how-to-bind-elasticsearch-2-0-on-both-loopback-and-non-loopback-interfaces/33438638#33438638). It's a problem with the interface in which elasticsearch is bound

---

<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, 11:36pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-java-api/34313/8 "2017-07-05T23:36:32Z")

</div>


