# Problems running Transport Client and Node Client on the same machine

**URL:** <https://discuss.elastic.co/t/problems-running-transport-client-and-node-client-on-the-same-machine/10805>\
**Category:** Elasticsearch\
**Created:** [February 19, 2013, 5:00pm UTC](https://discuss.elastic.co/t/problems-running-transport-client-and-node-client-on-the-same-machine/10805 "2013-02-19T17:00:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Per\_Ekman](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@Per\_Ekman](https://discuss.elastic.co/u/Per_Ekman)\
**Post date:** [February 19, 2013, 5:00pm UTC](https://discuss.elastic.co/t/problems-running-transport-client-and-node-client-on-the-same-machine/10805/1 "2013-02-19T17:00:18Z")

</div>

Hi

I'm trying to set up a test case where the setUp of the test case sets up  
both a Node Client and then talks to the Node Client through the Transport  
Client. There is something that I'm missing as the Transport Client can  
easily communicate with another cluster, but not the one in set up within  
the test case. Keep getting the  
"org.elasticsearch.client.transport.NoNodeAvailableException: No node  
available"-exception.

My NodeClient is created like this:

```
protected void init() throws UnknownHostException {
    
    String hostName = java.net.InetAddress.getLocalHost().getHostName();
    Builder settingsBuilder = ImmutableSettings.settingsBuilder();
    Settings settings = settingsBuilder.build();
    
    nodebuilder = nodeBuilder();
    nodebuilder.client(false);
    nodebuilder.local(true);
    nodebuilder.clusterName(hostName);
    nodebuilder.settings(settings);

    Node node = nodebuilder.node();
    client = node.client();

```

My TransportClient is created like this (where cluster and host gets the  
hostName as above):

```
    Settings settings = 

```

ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();

```
    client = new TransportClient(settings).addTransportAddress(new 

```

InetSocketTransportAddress(host, port));

When I execute this I get an exception:

boolean indexExists =  
client.admin().indices().prepareExists(index).execute().actionGet().exists();

Anybody got any ideas?

And this is the exception:

org.elasticsearch.client.transport.NoNodeAvailableException: No node  
available  
at  
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:202)  
at  
org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:85)  
at  
org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:140)  
at  
org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder.doExecute(IndicesExistsRequestBuilder.java:43)  
at  
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:62)  
at  
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:57)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [February 20, 2013, 5:22pm UTC](https://discuss.elastic.co/t/problems-running-transport-client-and-node-client-on-the-same-machine/10805/2 "2013-02-20T17:22:30Z")

</div>

Per Ekman wrote:

> I'm trying to set up a test case where the setUp of the test case sets up  
> both a Node Client and then talks to the Node Client through the Transport  
> Client.

[...]

> ```
> nodebuilder = nodeBuilder();
> nodebuilder.client(false);
> nodebuilder.local(true);
> 
> ```

You've set your data node to be local, which means it doesn't listen  
on a tcp address:

> ```
> client = new TransportClient(settings).addTransportAddress(new 
> 
> ```
> 
> InetSocketTransportAddress(host, port));

If you want to use local, then just talk directly to the first node  
you created. If you really need to test TransportClient  
communication, then set nodebuilder.local(false) above.

-Drew

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Per\_Ekman](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@Per\_Ekman](https://discuss.elastic.co/u/Per_Ekman)\
**Post date:** [February 22, 2013, 9:30am UTC](https://discuss.elastic.co/t/problems-running-transport-client-and-node-client-on-the-same-machine/10805/3 "2013-02-22T09:30:29Z")

</div>

thanks for the explaination. Discovered after a while it must be set to  
false. Need to do this as we are using the TransportClient behind the  
interface that we're testing

On Wed, Feb 20, 2013 at 6:22 PM, Drew Raines [aaraines@gmail.com](mailto:aaraines@gmail.com) wrote:

> Per Ekman wrote:
> 
> > I'm trying to set up a test case where the setUp of the test case sets up  
> > both a Node Client and then talks to the Node Client through the  
> > Transport  
> > Client.
> 
> [...]
> 
> > ```
> > nodebuilder = nodeBuilder();
> > nodebuilder.client(false);
> > nodebuilder.local(true);
> > 
> > ```
> 
> You've set your data node to be local, which means it doesn't listen  
> on a tcp address:
> 
> > ```
> > client = new TransportClient(settings).addTransportAddress(new
> > 
> > ```
> > 
> > InetSocketTransportAddress(host, port));
> 
> If you want to use local, then just talk directly to the first node  
> you created. If you really need to test TransportClient  
> communication, then set nodebuilder.local(false) above.
> 
> -Drew
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:50am UTC](https://discuss.elastic.co/t/problems-running-transport-client-and-node-client-on-the-same-machine/10805/4 "2017-07-06T02:50:06Z")

</div>


