Question

I have a spring-hibernate web application featured with hazelcast version:1.9.4.8 I use default hazelcast configuration rather than spring integration. I use JUnit non-transactional tests for unit tests. I use @Before to shutdown all instances of Hazelcast at first place. And similarly @After to cleanup.

Due to my computer is in my company's network, I was configuring hazelcast tcp-ip enabled with respective IP's of whom is going to test and use that application on its own local.

However, whenever I changed IP's from network ip's to 127.0.0.1, I cannot make it possible to join multiple members. But before, when ip's of conf. was like: 192.168.24.27

I need to change it from specific ip adresses to standart like 127.0.0.1 in order to enable different developers also to work tests on their own computers...

Here is a part of my sample unit test:

  ///
        LOG.info("test is begining");
        Map map;
        int memberSize = 0;
        Config config = new Config();
        // Hazelcast cluster member 1
        final HazelcastInstance customInstance1 = Hazelcast.newHazelcastInstance(null);  
        assertEquals(2, clusterListener.getMemberSize());   
        getApplicationMap().put("member2", 2);  

        // shutdown member 1
        customInstance1.getLifecycleService().shutdown(); 

        // Hazelcast cluster new member 1
        final HazelcastInstance customInstance2 = Hazelcast.newHazelcastInstance(null); 
        assertEquals(2, clusterListener.getMemberSize());   
        getApplicationMap().put("member2_new", 2);  

        assertEquals(3, getApplicationMap().size()); 

        LOG.info("\n\n *** Hazelcast test is OK. *** \n");
  ///

Here is the short but related part of my hazelcast configuration for my problem: ...

<port auto-increment="true">5701</port>
    <join>
        <multicast enabled="false">
            <multicast-group>224.2.2.3</multicast-group>
            <multicast-port>54327</multicast-port>
        </multicast>
        <tcp-ip enabled="true">
            <interface>127.0.0.1</interface>  // it was 192.168.24.27 before and was working
        </tcp-ip>
    </join>
    <interfaces enabled="true">
            <interface>127.0.0.*</interface> 
    </interfaces>

...

Here the related log: ...

Members [1] {
Member [127.0.0.1:5701] this
}


28.Eyl.2012 16:01:40 com.hazelcast.impl.management.ManagementCenterService
INFO: /127.0.0.1:5701 [elekCluster] Hazelcast Management Center started at port 5801.
28.Eyl.2012 16:01:40 com.hazelcast.impl.LifecycleServiceImpl
INFO: /127.0.0.1:5701 [elekCluster] Address[127.0.0.1:5701] is STARTED
16:01:40,149  INFO HazelcastTest:35 - test is begining
28.Eyl.2012 16:01:40 com.hazelcast.config.XmlConfigBuilder
INFO: Looking for hazelcast.xml config file in classpath.
28.Eyl.2012 16:01:40 com.hazelcast.config.XmlConfigBuilder
INFO: Using configuration file /C:/dev/WORKSPACE_Myeclipse/elek_workspace/elek/elek_core_service/target/test-classes/hazelcast.xml in the classpath.
28.Eyl.2012 16:01:40 com.hazelcast.system
INFO: /127.0.0.1:5702 [elekCluster] Hazelcast 1.9.4.8 (20120209) starting at Address[127.0.0.1:5702]
28.Eyl.2012 16:01:40 com.hazelcast.system
INFO: /127.0.0.1:5702 [elekCluster] Copyright (C) 2008-2011 Hazelcast.com
28.Eyl.2012 16:01:40 com.hazelcast.impl.LifecycleServiceImpl
INFO: /127.0.0.1:5702 [elekCluster] Address[127.0.0.1:5702] is STARTING
28.Eyl.2012 16:01:40 com.hazelcast.impl.TcpIpJoiner
INFO: /127.0.0.1:5702 [elekCluster] connecting to Address[127.0.0.1:5703]
28.Eyl.2012 16:01:40 com.hazelcast.impl.TcpIpJoiner
INFO: /127.0.0.1:5702 [elekCluster] connecting to Address[127.0.0.1:5701]
28.Eyl.2012 16:01:40 com.hazelcast.nio.InSelector
INFO: /127.0.0.1:5701 [elekCluster] 5701 is accepting socket connection from /127.0.0.1:63486
28.Eyl.2012 16:01:40 com.hazelcast.nio.InSelector
INFO: /127.0.0.1:5701 [elekCluster] 5701 accepted socket connection from /127.0.0.1:63486
28.Eyl.2012 16:01:40 com.hazelcast.nio.ConnectionManager
WARNING: /127.0.0.1:5701 [elekCluster] Two connections from the same endpoint Address[127.0.0.1:5702], acceptTypeConnection=true,  now accept=false
28.Eyl.2012 16:01:40 com.hazelcast.nio.InSelector
INFO: /127.0.0.1:5702 [elekCluster] 5702 is accepting socket connection from /127.0.0.1:63479
28.Eyl.2012 16:01:40 com.hazelcast.nio.InSelector
INFO: /127.0.0.1:5702 [elekCluster] 5702 accepted socket connection from /127.0.0.1:63479
28.Eyl.2012 16:01:40 com.hazelcast.cluster.ClusterManager
INFO: /127.0.0.1:5702 [elekCluster] Removing Address Address[127.0.0.1:5701]
28.Eyl.2012 16:01:45 com.hazelcast.impl.TcpIpJoiner
INFO: /127.0.0.1:5702 [elekCluster] 


Members [1] {
    Member [127.0.0.1:5702] this
}
...

I would appreciate any help, thanks in advance..

Was it helpful?

Solution 2

When I upgraded the version of hazelcast from 1.9.4.8 to 2.3.1 the problem is gone.

OTHER TIPS

See related mail thread in the mail group.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top