0
votes

My configuration :

public Config getConfig() {
    Config cfg = new Config();
    cfg.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
    cfg.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("10.0.0.1");
    cfg.getNetworkConfig().setPort(5900).setPortAutoIncrement(true);
    cfg.getNetworkConfig().getInterfaces().setEnabled(true).addInterface( "192.168.43.225" );
    cfg.getManagementCenterConfig().setEnabled(true).setUrl("http://localhost:5901/mancenter");
    return cfg;
}

public HazelcastInstance getHazelcastInstance() {
    try {
        hazelcastInstance = Hazelcast.newHazelcastInstance(getConfig());
    }catch (Exception e){
        System.out.println("Exception :: " + e);
    }

    return hazelcastInstance;
}

Exception :

2019-10-20 00:07:15.460 INFO 12259 --- [cached.thread-3] com.hazelcast.nio.tcp.TcpIpConnector : [192.168.43.225]:5900 [dev] [3.12.2] Connecting to /10.0.0.1:5902, timeout: 10000, bind-any: true 2019-10-20 00:07:15.460 INFO 12259 --- [cached.thread-2] com.hazelcast.nio.tcp.TcpIpConnector : [192.168.43.225]:5900 [dev] [3.12.2] Connecting to /10.0.0.1:5901, timeout: 10000, bind-any: true 2019-10-20 00:07:15.461 INFO 12259 --- [cached.thread-1] com.hazelcast.nio.tcp.TcpIpConnector : [192.168.43.225]:5900 [dev] [3.12.2] Connecting to /10.0.0.1:5900, timeout: 10000, bind-any: true 2019-10-20 00:07:30.817 WARN 12259 --- [.IO.thread-in-2] com.hazelcast.nio.tcp.TcpIpConnection : [192.168.43.225]:5900 [dev] [3.12.2] Connection[id=3, /192.168.43.225:49045->/10.0.0.1:5900, qualifier=null, endpoint=[10.0.0.1]:5900, alive=false, type=NONE] closed. Reason: Exception in Connection[id=3, /192.168.43.225:49045->/10.0.0.1:5900, qualifier=null, endpoint=[10.0.0.1]:5900, alive=true, type=NONE], thread=hz._hzInstance_1_dev.IO.thread-in-2

java.io.IOException: Connection reset by peer

1

1 Answers

0
votes
cfg.getNetworkConfig().getInterfaces().setEnabled(true).addInterface( "192.168.43.225" );

Interfaces configuration is used when you have multiple network interfaces on the host machine and you want to force Hazelcast to use some of them. Please take a look at Interfaces Section for more info.

[192.168.43.225]:5900 [dev] [3.12.2] Connection[id=3, /192.168.43.225:49045->/10.0.0.1:5900, qualifier=null, endpoint=[10.0.0.1]:5900, alive=false, type=NONE] closed. Reason: Exception in Connection[id=3, /192.168.43.225:49045->/10.0.0.1:5900, qualifier=null, endpoint=[10.0.0.1]:5900, alive=true, type=NONE], thread=hz._hzInstance_1_dev.IO.thread-in-2

This shows that you have connectivity issue. You need to make sure 10.0.0.1 is reachable from IP address 192.168.43.225.