# TransportClient hangs on addTransportClient

**URL:** https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671
**Category:** Elasticsearch
**Created:** [June 21, 2011, 12:51pm UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671 "2011-06-21T12:51:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Rob\_Young](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rob_young/32/3206_2.png) [@Rob\_Young](https://discuss.elastic.co/u/Rob_Young)
#### Post date: [June 21, 2011, 12:51pm UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671/1 "2011-06-21T12:51:51Z")

</div>

I have set up and started an elastic search node and confirmed it's  
working with a couple of Python scripts. I have indexed a bunch of  
documents and am able to search over them. However, I am having  
trouble getting the Java client API working. So far I just have a very  
simple class that attempts to connect to the server with a  
TransportClient but it's hanging on the call to addTransportAddress.

public class ElasticTest {  
public static void main(String[] args) {  
Settings settings = ImmutableSettings.settingsBuilder() //  
.put("cluster.name", "hotels") //  
.put("client.transport.sniff", false) //  
.build();  
TransportClient client = new TransportClient(settings);  
InetSocketTransportAddress transAddress = new  
InetSocketTransportAddress("linux-dev", 9200);  
client.addTransportAddress(transAddress);  
client.close();  
}  
}

I have tried debugging it and hanging in  
org.elasticsearch.client.transport.TransportClientNodeService on line  
176 (stack copied below). Do you know what I might be doing wrong?

com.travelmatch.playground.ElasticTest at localhost:53279  
Thread [main] (Suspended (breakpoint at line 176 in  
TransportClientNodesService$ScheduledConnectNodeSampler))  
TransportClientNodesService$ScheduledConnectNodeSampler.run() line:  
176  
TransportClientNodesService.addTransportAddress(TransportAddress)  
line: 118  
TransportClient.addTransportAddress(TransportAddress) line: 198  
ElasticTest.main(String[]) line: 16  
Daemon Thread [elasticsearch[Agon][timer]] (Running)  
Daemon Thread [elasticsearch[Agon][scheduler]-pool-8-thread-1]  
(Running)  
Daemon Thread [New I/O client worker #1-2] (Running)  
Daemon Thread [New I/O client worker #1-3] (Running)  
Daemon Thread [New I/O client worker #1-1] (Running)  
Daemon Thread [New I/O client worker #1-8] (Running)  
Daemon Thread [New I/O client worker #1-6] (Running)  
Daemon Thread [New I/O client worker #1-7] (Running)  
Daemon Thread [New I/O client worker #1-5] (Running)  
Daemon Thread [New I/O client worker #1-4] (Running)  
Daemon Thread [elasticsearch[cached]-pool-1-thread-1] (Running)

---

<div class="post-metadata">

### Author: ![melix](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@melix](https://discuss.elastic.co/u/melix)
#### Post date: [June 21, 2011, 12:54pm UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671/2 "2011-06-21T12:54:01Z")

</div>

I had the same problem and eventually found that I had to use port 9300.

Le 21/06/2011 14:51, Rob Young a Ã©crit :

> I have set up and started an Elasticsearch node and confirmed it's  
> working with a couple of Python scripts. I have indexed a bunch of  
> documents and am able to search over them. However, I am having  
> trouble getting the Java client API working. So far I just have a very  
> simple class that attempts to connect to the server with a  
> TransportClient but it's hanging on the call to addTransportAddress.
> 
> public class ElasticTest {  
> public static void main(String args) {  
> Settings settings = ImmutableSettings.settingsBuilder() //  
> .put("cluster.name", "hotels") //  
> .put("client.transport.sniff", false) //  
> .build();  
> TransportClient client = new TransportClient(settings);  
> InetSocketTransportAddress transAddress = new  
> InetSocketTransportAddress("linux-dev", 9200);  
> client.addTransportAddress(transAddress);  
> client.close();  
> }  
> }
> 
> I have tried debugging it and hanging in  
> org.elasticsearch.client.transport.TransportClientNodeService on line  
> 176 (stack copied below). Do you know what I might be doing wrong?
> 
> com.travelmatch.playground.ElasticTest at localhost:53279  
> Thread [main] (Suspended (breakpoint at line 176 in  
> TransportClientNodesService$ScheduledConnectNodeSampler))  
> TransportClientNodesService$ScheduledConnectNodeSampler.run() line:  
> 176  
> TransportClientNodesService.addTransportAddress(TransportAddress)  
> line: 118  
> TransportClient.addTransportAddress(TransportAddress) line: 198  
> ElasticTest.main(String) line: 16  
> Daemon Thread [elasticsearch[Agon][timer]] (Running)  
> Daemon Thread [elasticsearch[Agon][scheduler]-pool-8-thread-1]  
> (Running)  
> Daemon Thread [New I/O client worker #1-2] (Running)  
> Daemon Thread [New I/O client worker #1-3] (Running)  
> Daemon Thread [New I/O client worker #1-1] (Running)  
> Daemon Thread [New I/O client worker #1-8] (Running)  
> Daemon Thread [New I/O client worker #1-6] (Running)  
> Daemon Thread [New I/O client worker #1-7] (Running)  
> Daemon Thread [New I/O client worker #1-5] (Running)  
> Daemon Thread [New I/O client worker #1-4] (Running)  
> Daemon Thread [elasticsearch[cached]-pool-1-thread-1] (Running)

---

<div class="post-metadata">

### Author: ![Rob\_Young](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rob_young/32/3206_2.png) [@Rob\_Young](https://discuss.elastic.co/u/Rob_Young)
#### Post date: [June 21, 2011, 1:37pm UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671/3 "2011-06-21T13:37:48Z")

</div>

Thank you Cédric, that has indeed fixed the problem. Can anyone tell  
me why Python connects on port 9200 but Java connects on port 9300?

On Jun 21, 1:54 pm, Cédric Champeau [cedric.champ...@lingway.com](mailto:cedric.champ...@lingway.com)  
wrote:

> I had the same problem and eventually found that I had to use port 9300.
> 
> Le 21/06/2011 14:51, Rob Young a crit :
> 
> > I have set up and started an Elasticsearch node and confirmed it's  
> > working with a couple of Python scripts. I have indexed a bunch of  
> > documents and am able to search over them. However, I am having  
> > trouble getting the Java client API working. So far I just have a very  
> > simple class that attempts to connect to the server with a  
> > TransportClient but it's hanging on the call to addTransportAddress.
> 
> > public class ElasticTest {  
> > public static void main(String args) {  
> > Settings settings = ImmutableSettings.settingsBuilder() //  
> > .put("cluster.name", "hotels") //  
> > .put("client.transport.sniff", false) //  
> > .build();  
> > TransportClient client = new TransportClient(settings);  
> > InetSocketTransportAddress transAddress = new  
> > InetSocketTransportAddress("linux-dev", 9200);  
> > client.addTransportAddress(transAddress);  
> > client.close();  
> > }  
> > }
> 
> > I have tried debugging it and hanging in  
> > org.elasticsearch.client.transport.TransportClientNodeService on line  
> > 176 (stack copied below). Do you know what I might be doing wrong?
> 
> > com.travelmatch.playground.ElasticTest at localhost:53279  
> > Thread [main] (Suspended (breakpoint at line 176 in  
> > TransportClientNodesService$ScheduledConnectNodeSampler))  
> > TransportClientNodesService$ScheduledConnectNodeSampler.run() line:  
> > 176  
> > TransportClientNodesService.addTransportAddress(TransportAddress)  
> > line: 118  
> > TransportClient.addTransportAddress(TransportAddress) line: 198  
> > ElasticTest.main(String) line: 16  
> > Daemon Thread [elasticsearch[Agon][timer]] (Running)  
> > Daemon Thread [elasticsearch[Agon][scheduler]-pool-8-thread-1]  
> > (Running)  
> > Daemon Thread [New I/O client worker #1-2] (Running)  
> > Daemon Thread [New I/O client worker #1-3] (Running)  
> > Daemon Thread [New I/O client worker #1-1] (Running)  
> > Daemon Thread [New I/O client worker #1-8] (Running)  
> > Daemon Thread [New I/O client worker #1-6] (Running)  
> > Daemon Thread [New I/O client worker #1-7] (Running)  
> > Daemon Thread [New I/O client worker #1-5] (Running)  
> > Daemon Thread [New I/O client worker #1-4] (Running)  
> > Daemon Thread [elasticsearch[cached]-pool-1-thread-1] (Running)

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 21, 2011, 1:44pm UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671/4 "2011-06-21T13:44:08Z")

</div>

On Tue, 2011-06-21 at 06:37 -0700, Rob Young wrote:

> Thank you CÃ©dric, that has indeed fixed the problem. Can anyone tell  
> me why Python connects on port 9200 but Java connects on port 9300?

9200 is for http transport, 9500 for thrift transport, and 9300 for ES's  
"internal" transport, ie a protocol which only the ES server and clients  
speak

clint

---

<div class="post-metadata">

### Author: ![razjnev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/razjnev/32/3203_2.png) [@razjnev](https://discuss.elastic.co/u/razjnev)
#### Post date: [June 22, 2011, 7:42am UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671/5 "2011-06-22T07:42:35Z")

</div>

Further to what Clint said, you can find out exactly which addresses  
and ports are being used by the nodes by using the http API to  
retrieve the node information:  
curl -XGET [http://localhost:9200/\_cluster/nodes](http://localhost:9200/_cluster/nodes)

This returns the node information in json format and the address and  
port which the node has published for internal transport is shown as  
e.g. "transport\_address":"inet[/127.0.0.1:9300]". Alternatively if you  
are using an admin client e.g. [http://mobz.github.com/elasticsearch-head/](http://mobz.github.com/elasticsearch-head/)  
then you can use that to query the cluster nodes information.

If you add more nodes to the cluster from the same machine they will  
use different ports, the default setting is to use ports in the range  
9300-9400 for the transport module, see  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/transport.html).

regards,  
Caroline

On Jun 21, 2:44 pm, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> On Tue, 2011-06-21 at 06:37 -0700, Rob Young wrote:
> 
> > Thank you Cédric, that has indeed fixed the problem. Can anyone tell  
> > me why Python connects on port 9200 but Java connects on port 9300?
> 
> 9200 is for http transport, 9500 for thrift transport, and 9300 for ES's  
> "internal" transport, ie a protocol which only the ES server and clients  
> speak
> 
> clint

---

<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, 4:02am UTC](https://discuss.elastic.co/t/transportclient-hangs-on-addtransportclient/4671/6 "2017-07-06T04:02:58Z")

</div>


