I am trying to use hazelcast v3.2.4 (same version on server and client). The server (as simple an implementation that I could put in place) is running on a server. The client tries to connect to the remote server - the server prints the authentication requests but I receive the following log outputs (including exceptions) - any ideas on what I can do differently (copying both log output and config file). I am trying to connect via TCP/IP and I checked for network connectivity - I could not see anything blocking the connection.
Line of Code mentioned in stack:
final ClientConfig config= new XmlClientConfigBuilder("config/hazelcast.xml").build();
HazelcastInstance hcast = HazelcastClient.newHazelcastClient(config); //this is mentioned in stack trace
Config
<hazelcast-client xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-client-config-3.1.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>dev</name>
<password>dev-pass</password>
</group>
<management-center enabled="false">http://localhost:8080/mancenter</management-center>
<network>
<cluster-members>
<address>xxx.xxx.xxx.xxx</address>
</cluster-members>
<smart-routing>true</smart-routing>
<redo-operation>true</redo-operation>
<connection-pool-size>30</connection-pool-size>
<port auto-increment="true" port-count="100">5701</port>
<outbound-ports>
<ports>0</ports>
</outbound-ports>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<tcp-ip enabled="false">
<interface>xxx.xxx.xxx.xxx</interface>
</tcp-ip>
<aws enabled="false">
<access-key>my-access-key</access-key>
<secret-key>my-secret-key</secret-key>
<region>us-west-1</region>
<host-header>ec2.amazonaws.com</host-header>
<security-group-name>hazelcast-sg</security-group-name>
<tag-key>type</tag-key>
<tag-value>hz-nodes</tag-value>
</aws>
</join>
<interfaces enabled="false">
<interface>10.10.1.*</interface>
</interfaces>
<ssl enabled="false" />
<socket-interceptor enabled="false" />
<symmetric-encryption enabled="false">
<algorithm>PBEWithMD5AndDES</algorithm>
<salt>thesalt</salt>
<password>thepass</password>
<iteration-count>19</iteration-count>
</symmetric-encryption>
</network>
Log output
Sep 05, 2014 4:06:02 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.4] is STARTING
Sep 05, 2014 4:06:02 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.4] is STARTED
Sep 05, 2014 4:06:02 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.4] is CLIENT_CONNECTED
Sep 05, 2014 4:06:02 PM com.hazelcast.client.spi.ClientClusterService
INFO:
Members [1] {
Member [127.0.0.1]:5701
}
Sep 05, 2014 4:06:22 PM com.hazelcast.client.spi.ClientPartitionService
SEVERE: Error while fetching cluster partition table!
com.hazelcast.spi.exception.RetryableIOException: java.util.concurrent.ExecutionException: com.hazelcast.core.HazelcastException: java.net.ConnectException: Connection refused: no further information
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.getOrConnect(ClientConnectionManagerImpl.java:319)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.tryToConnect(ClientConnectionManagerImpl.java:261)
at com.hazelcast.client.spi.impl.ClientInvocationServiceImpl.send(ClientInvocationServiceImpl.java:149)
at com.hazelcast.client.spi.impl.ClientInvocationServiceImpl.invokeOnTarget(ClientInvocationServiceImpl.java:59)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.getPartitionsFrom(ClientPartitionServiceImpl.java:105)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.getInitialPartitions(ClientPartitionServiceImpl.java:94)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.start(ClientPartitionServiceImpl.java:60)
at com.hazelcast.client.HazelcastClient.start(HazelcastClient.java:223)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:186)
at com.xxx.test.HCastClientAccessor.getHCastInstance(HCastClientAccessor.java:55)
at com.xxx.test.HCastTest.<clinit>(HCastTest.java:12)
Caused by: java.util.concurrent.ExecutionException: com.hazelcast.core.HazelcastException: java.net.ConnectException: Connection refused: no further information
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:262)
at java.util.concurrent.FutureTask.get(FutureTask.java:119)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.getOrConnect(ClientConnectionManagerImpl.java:316)
... 10 more
Caused by: com.hazelcast.core.HazelcastException: java.net.ConnectException: Connection refused: no further information
at com.hazelcast.util.ExceptionUtil.rethrow(ExceptionUtil.java:45)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:384)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:332)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
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)
at com.hazelcast.util.executor.PoolExecutorThreadFactory$ManagedThread.run(PoolExecutorThreadFactory.java:59)
Caused by: java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:115)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:365)
... 11 more
Server output
INFO: [127.0.0.1]:5701 [dev] [3.2.4] Accepting socket connection from /xxx.xxx.xxx.xxx:49705
Sep 05, 2014 4:05:57 PM com.hazelcast.nio.TcpIpConnectionManager
INFO: [127.0.0.1]:5701 [dev] [3.2.4] 5701 accepted socket connection from /xxx.xxx.xxx.xxx:49705
Sep 05, 2014 4:05:57 PM com.hazelcast.client.AuthenticationRequest
INFO: [127.0.0.1]:5701 [dev] [3.2.4] Received auth from Connection [/xxx.xxx.xxx.xxx:49705 -> null] live=true, client=true, type=JAVA_CLIENT, successfully authenticated
Sep 05, 2014 4:09:43 PM com.hazelcast.nio.TcpIpConnection
INFO: [127.0.0.1]:5701 [dev] [3.2.4] Connection [Address[xxx.xxx.xxx.xxx]:49705] lost. Reason: java.io.IOException[Connection reset by peer]
Sep 05, 2014 4:09:43 PM com.hazelcast.client.ClientEngine
INFO: [127.0.0.1]:5701 [dev] [3.2.4] Destroying ClientEndpoint{conn=Connection [/xxx.xxx.xxx.xxx:49705 -> Address[xxx.xxx.xxx.xxx]:49705] live=false, client=true, type=JAVA_CLIENT, uuid='70afcf60-96e0-444d-8981-3aa983530514', firstConnection=true, authenticated=true}
Sep 05, 2014 4:09:43 PM com.hazelcast.nio.ReadHandler
WARNING: [127.0.0.1]:5701 [dev] [3.2.4] hz._hzInstance_1_dev.IO.thread-in-0 Closing socket to endpoint Address[192.168.101.106]:49705, Cause:java.io.IOException: Connection reset by peer
Update:
I switched to this client config but I still get an exception on the client end. I copied the server and client output - the server receives the connection request but then on the client end, I see the same error as mentioned above "SEVERE: Error while fetching cluster partition table!" - same trace as above.
New client config
<hazelcast-client xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-client-config-3.2.4.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>dev</name>
<password>dev-pass</password>
</group>
<management-center enabled="false">http://localhost:8080/mancenter</management-center>
<network>
<cluster-members>
<address>xxx.xxx.xxx.xxx</address>
</cluster-members>
<smart-routing>true</smart-routing>
<redo-operation>true</redo-operation>
<connection-timeout>60000</connection-timeout>
<connection-attempt-limit>10</connection-attempt-limit>
<connection-pool-size>30</connection-pool-size>
</network>
<executor-pool-size>40</executor-pool-size> <!-- added -->
</hazelcast-client>
Server output:
Sep 07, 2014 5:57:01 PM com.hazelcast.nio.SocketAcceptor
INFO: [127.0.0.1]:5701 [dev] [3.2.4] Accepting socket connection from /xxx.xxx.xxx.xxx:58521
Sep 07, 2014 5:57:01 PM com.hazelcast.nio.TcpIpConnectionManager
INFO: [127.0.0.1]:5701 [dev] [3.2.4] 5701 accepted socket connection from /xxx.xxx.xxx.xxx:58521
Sep 07, 2014 5:57:03 PM com.hazelcast.client.AuthenticationRequest
INFO: [127.0.0.1]:5701 [dev] [3.2.4] Received auth from Connection [/xxx.xxx.xxx.xxx:58521 -> null] live=true, client=true, type=JAVA_CLIENT, successfully authenticated
Client output
Sep 07, 2014 5:58:04 PM com.hazelcast.client.spi.ClientPartitionService
SEVERE: Error while fetching cluster partition table!
com.hazelcast.spi.exception.RetryableIOException: java.util.concurrent.ExecutionException: com.hazelcast.core.HazelcastException: java.net.ConnectException: Connection refused: no further information
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.getOrConnect(ClientConnectionManagerImpl.java:319)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.tryToConnect(ClientConnectionManagerImpl.java:261)
at com.hazelcast.client.spi.impl.ClientInvocationServiceImpl.send(ClientInvocationServiceImpl.java:149)
at com.hazelcast.client.spi.impl.ClientInvocationServiceImpl.invokeOnTarget(ClientInvocationServiceImpl.java:59)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.getPartitionsFrom(ClientPartitionServiceImpl.java:105)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.getInitialPartitions(ClientPartitionServiceImpl.java:94)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.start(ClientPartitionServiceImpl.java:60)
at com.hazelcast.client.HazelcastClient.start(HazelcastClient.java:223)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:186)
Update
I tried this for client and server and I got the same exception as above - what am I doing wrong:
Client ClientConfig clientConfig = new ClientConfig().addAddress("xxx.xxx.xxx.xxx"); HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
Server
HazelcastInstance hcast = Hazelcast.newHazelcastInstance();
Update In short, make sure the config for both server and client are correct (do not mix up tags from one set to another). For the server, ensure that the hazelcast server is listening on the external IP address (not the loopback addresS), that there are no firewall settings blocking the connection (on client, server or in-between). Thanks to Peter - I'm back to using hazelcast and enjoying my experience of using this tool. Strongly recommended!