I've the following problem: to do an integration test, I set up an embedded 
node and then I create a TransportClient to connect to it. 

The setup of the embedded node is (among other things):


 port = 11547; // User ports range 1024 - 49151
        tcpport = 9300;
        settings.put("http.port", port);
        settings.put("transport.tcp.port", tcpport);
     
        Settings esSettings = settings.build();


        node = NodeBuilder.nodeBuilder().local(true).settings(esSettings).
node();  //I tried setting local to false too
        node.start();


and the transportclient is as simple as:




  TransportClient client = new TransportClient();
        client.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));


        client.prepareIndex("test", "type").setSource("field", "value").
execute().actionGet();




(I tried both localhost and 127.0.0.1). 

Anyway I get a connection refused when running the above code:


Caused by: java.net.ConnectException: Connection refused: localhost/127.0.
0.1:9300
 at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
 at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
 at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(
NioClientBoss.java:150)
 at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
processSelectedKeys(NioClientBoss.java:105)
 at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(
NioClientBoss.java:79)
 at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.
run(AbstractNioSelector.java:318)
 at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(
NioClientBoss.java:42)
 at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:108)
 at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(
DeadLockProofWorker.java:42)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
java:615)
 at java.lang.Thread.run(Thread.java:724)
[2014-04-01 17:48:10,836][TRACE][org.elasticsearch.transport.netty] [Cap 'N 
Hawk] connect exception caught on transport layer [[id: 0x9526b405]]
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9300
 at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
 at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
 at 
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
 at 
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
 at 
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
 at 
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
 at 
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
 at 
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
 at 
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
 at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:724)



my colleague was successful when he tried to connect to another host. but 
he fails with localhost. 

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a8c21baf-4d41-4d43-b695-660dbba85623%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to