For the example to work, both classes need to be run in separated JVMs. Each JVM needs to have the parameter -Dhazelcast.config=cluster.xml.