# Upgraded from 1.4 to 2.2, now my connection fails from Java code

**URL:** <https://discuss.elastic.co/t/upgraded-from-1-4-to-2-2-now-my-connection-fails-from-java-code/43423>\
**Category:** Elasticsearch\
**Created:** [March 3, 2016, 5:11pm UTC](https://discuss.elastic.co/t/upgraded-from-1-4-to-2-2-now-my-connection-fails-from-java-code/43423 "2016-03-03T17:11:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Nelson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tony_nelson/32/3411_2.png) [@Tony\_Nelson](https://discuss.elastic.co/u/Tony_Nelson)\
**Post date:** [March 3, 2016, 5:11pm UTC](https://discuss.elastic.co/t/upgraded-from-1-4-to-2-2-now-my-connection-fails-from-java-code/43423/1 "2016-03-03T17:11:05Z")

</div>

I have a simple method that creates my Client object, using either the Node or Transport classes, depending where the client is running in the network. I use Node when the client is on the same physical network as the servers, and transport when it it's remote. My code is quite simple:

```
        final Settings settings = Settings.settingsBuilder()
                .put("cluster.name", "ih-demo")
                .put("node.name", nodeName)
                .put("http.enabled", false)
                .put("client.transport.sniff", true)
                .build();

        switch (nodeType) {
            case "node":
                NODE = nodeBuilder()
                        .settings(settings)
                        .client(true)
                        .node();

                CLIENT = NODE.client();
                break;

            case "transport":

                try {
                    CLIENT = TransportClient.builder().settings(settings).build()
                            .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("demo.starpoint.com"), 9300));
                }
                catch (UnknownHostException uhe) {
                    throw new BusinessException(uhe);
                }

                break;

            default:
                throw new BusinessException("Unhandled node type: " + nodeType);
        }

```

When I start my clients in transport mode, they work fine. When I start in node mode, I eventually see the following exception:

2016-03-03T11:59:39-05:00 [elasticsearch[mqconsumer][generic][T#6]] WARN org.elasticsearch.discovery.zen.ping.unicast [mqconsumer] failed to send ping to [{#z#!/bin/bash  
en\_unicast\_4#}{127.0.0.1}{127.0.0.1:9303}]  
SendRequestTransportException[[][127.0.0.1:9303][internal:discovery/zen/unicast]]; nested: NodeNotConnectedException[[][127.0.0.1:9303] Node not connected];  
at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:323)  
at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing.sendPingRequestToNode(UnicastZenPing.java:440)  
at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing.sendPings(UnicastZenPing.java:426)  
at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing.ping(UnicastZenPing.java:240)  
at org.elasticsearch.discovery.zen.ping.ZenPingService.ping(ZenPingService.java:106)  
at org.elasticsearch.discovery.zen.ping.ZenPingService.pingAndWait(ZenPingService.java:84)  
at org.elasticsearch.discovery.zen.ZenDiscovery.findMaster(ZenDiscovery.java:899)  
at org.elasticsearch.discovery.zen.ZenDiscovery.innerJoinCluster(ZenDiscovery.java:335)  
at org.elasticsearch.discovery.zen.ZenDiscovery.access$5000(ZenDiscovery.java:75)  
at org.elasticsearch.discovery.zen.ZenDiscovery$JoinThreadControl$1.run(ZenDiscovery.java:1260)  
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:745)  
Caused by: NodeNotConnectedException[[][127.0.0.1:9303] Node not connected]  
at org.elasticsearch.transport.netty.NettyTransport.nodeChannel(NettyTransport.java:1115)  
at org.elasticsearch.transport.netty.NettyTransport.sendRequest(NettyTransport.java:802)  
at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:312)  
... 12 more

The exception certainly is right, nothing is listening on port 9303 on localhost.

I tried googleing "elasticsearch 2.2 port 9303" but I couldn't find anything.

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Tony\_Nelson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tony_nelson/32/3411_2.png) [@Tony\_Nelson](https://discuss.elastic.co/u/Tony_Nelson)\
**Post date:** [March 4, 2016, 12:59pm UTC](https://discuss.elastic.co/t/upgraded-from-1-4-to-2-2-now-my-connection-fails-from-java-code/43423/2 "2016-03-04T12:59:36Z")

</div>

I solved my problem. I had to turn off network sniffing, and add all the nodes in the cluster to my settings.

```
        final Settings settings = Settings.settingsBuilder()
                .put("cluster.name", "ih-demo")
                .put("node.name", nodeName)
                .put("http.enabled", false)
                .put("discovery.zen.ping.multicast.enabled", false)
                .putArray("discovery.zen.ping.unicast.hosts", "demo.starpoint.com", "bender.starpoint.com")
                // .put("client.transport.sniff", true)
                .build();

```

The Node documentation page for 2.2 should be updated with the putArray example above (which I found in the shield docs), since multicast is is provided by a deprecated plugin.

I think the core of my problem is that my servers don't listen on localhost at, which makes the original error I was seeing make all the sense in the world.

---

<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:11pm UTC](https://discuss.elastic.co/t/upgraded-from-1-4-to-2-2-now-my-connection-fails-from-java-code/43423/3 "2017-07-05T23:11:16Z")

</div>


