Skip to content

Instantly share code, notes, and snippets.

@looztra
Last active August 29, 2015 14:18
Show Gist options
  • Save looztra/c1e3f6256642a3067961 to your computer and use it in GitHub Desktop.
Save looztra/c1e3f6256642a3067961 to your computer and use it in GitHub Desktop.
Hazelcast in Docker in boot2docker “Error while fetching cluster partition table”
C:\TOOLS\Java\jdk1.8.0_40\bin\java -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\TOOLS\IntelliJ-IDEA-14.1.x\IntelliJ IDEA 14.1.1\bin" -Dfile.encoding=windows-1252 -classpath "C:\TOOLS\Java\jdk1.8.0_40\jre\lib\charsets.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\deploy.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\javaws.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\jce.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\jfr.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\jfxswt.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\jsse.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\management-agent.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\plugin.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\resources.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\rt.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\access-bridge-64.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\cldrdata.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\dnsns.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\jaccess.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\jfxrt.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\localedata.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\nashorn.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\sunec.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\sunjce_provider.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\sunmscapi.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\sunpkcs11.jar;C:\TOOLS\Java\jdk1.8.0_40\jre\lib\ext\zipfs.jar;C:\WORK\SANDBOX\sandbox-hazelcast\target\classes;C:\Utilisateurs\fr20167\.m2\repository\com\hazelcast\hazelcast\3.4.2\hazelcast-3.4.2.jar;C:\Utilisateurs\fr20167\.m2\repository\net\sourceforge\findbugs\annotations\1.3.2\annotations-1.3.2.jar;C:\Utilisateurs\fr20167\.m2\repository\com\eclipsesource\minimal-json\minimal-json\0.9.1\minimal-json-0.9.1.jar;C:\Utilisateurs\fr20167\.m2\repository\com\hazelcast\hazelcast-client\3.4.2\hazelcast-client-3.4.2.jar;C:\TOOLS\IntelliJ-IDEA-14.1.x\IntelliJ IDEA 14.1.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain hazelcast.Client1
avr. 02, 2015 11:42:38 AM com.hazelcast.core.LifecycleService
INFOS: HazelcastClient[hz.client_0_test][3.4.2] is STARTING
avr. 02, 2015 11:42:39 AM com.hazelcast.core.LifecycleService
INFOS: HazelcastClient[hz.client_0_test][3.4.2] is STARTED
avr. 02, 2015 11:42:41 AM com.hazelcast.core.LifecycleService
INFOS: HazelcastClient[hz.client_0_test][3.4.2] is CLIENT_CONNECTED
avr. 02, 2015 11:42:41 AM com.hazelcast.client.spi.impl.ClusterListenerThread
INFOS:
Members [1] {
Member [10.0.2.15]:5701
}
avr. 02, 2015 11:44:21 AM com.hazelcast.client.spi.ClientPartitionService
GRAVE: Error while fetching cluster partition table!
java.net.SocketTimeoutException
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:118)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:386)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:353)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
Exception in thread "main" java.lang.IllegalStateException: Cannot get initial partitions!
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.getInitialPartitions(ClientPartitionServiceImpl.java:89)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.start(ClientPartitionServiceImpl.java:65)
at com.hazelcast.client.impl.HazelcastClientInstanceImpl.start(HazelcastClientInstanceImpl.java:189)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:81)
at hazelcast.Client1.main(Client1.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
docker@boot2docker:~$ docker run --rm --name hazelcast1 -p 5701:5701 -e "MIN_HEAP=256M" -e "MAX_HEAP=256M" -e "GROUP_NAME=test" -e "GROUP_PASS=test_pass" -e "PUBLIC_ADDRESS=10.0.2.15" looztra/deb-hazelcast
Apr 02, 2015 9:42:30 AM com.hazelcast.config.XmlConfigLocator
INFO: Loading configuration /opt/hazelcast/hazelcast.xml from System property 'hazelcast.config'
Apr 02, 2015 9:42:30 AM com.hazelcast.config.XmlConfigLocator
INFO: Using configuration file at /opt/hazelcast/hazelcast.xml
Apr 02, 2015 9:42:31 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [test] [3.4.2] Interfaces is disabled, trying to pick one address from TCP-IP config addresses: []
Apr 02, 2015 9:42:31 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [test] [3.4.2] Prefer IPv4 stack is true.
Apr 02, 2015 9:42:31 AM com.hazelcast.instance.DefaultAddressPicker
WARNING: [LOCAL] [test] [3.4.2] Could not find a matching address to start with! Picking one of non-loopback addresses.
Apr 02, 2015 9:42:31 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [test] [3.4.2] Picked Address[172.17.0.3]:5701, using socket ServerSocket[addr=/0.0.0.0,localport=5701], bind any local is true
Apr 02, 2015 9:42:31 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [test] [3.4.2] Using public address: Address[10.0.2.15]:5701
Apr 02, 2015 9:42:31 AM com.hazelcast.spi.OperationService
INFO: [10.0.2.15]:5701 [test] [3.4.2] Backpressure is disabled
Apr 02, 2015 9:42:31 AM com.hazelcast.spi.impl.BasicOperationScheduler
INFO: [10.0.2.15]:5701 [test] [3.4.2] Starting with 2 generic operation threads and 2 partition operation threads.
Apr 02, 2015 9:42:31 AM com.hazelcast.system
INFO: [10.0.2.15]:5701 [test] [3.4.2] Hazelcast 3.4.2 (20150326 - f6349a4) starting at Address[10.0.2.15]:5701
Apr 02, 2015 9:42:31 AM com.hazelcast.system
INFO: [10.0.2.15]:5701 [test] [3.4.2] Copyright (C) 2008-2014 Hazelcast.com
Apr 02, 2015 9:42:31 AM com.hazelcast.instance.Node
INFO: [10.0.2.15]:5701 [test] [3.4.2] Creating TcpIpJoiner
Apr 02, 2015 9:42:31 AM com.hazelcast.core.LifecycleService
INFO: [10.0.2.15]:5701 [test] [3.4.2] Address[10.0.2.15]:5701 is STARTING
Apr 02, 2015 9:42:31 AM com.hazelcast.cluster.impl.TcpIpJoiner
INFO: [10.0.2.15]:5701 [test] [3.4.2]
Members [1] {
Member [10.0.2.15]:5701 this
}
Apr 02, 2015 9:42:31 AM com.hazelcast.core.LifecycleService
INFO: [10.0.2.15]:5701 [test] [3.4.2] Address[10.0.2.15]:5701 is STARTED
Apr 02, 2015 9:42:39 AM com.hazelcast.nio.tcp.SocketAcceptor
INFO: [10.0.2.15]:5701 [test] [3.4.2] Accepting socket connection from /10.0.2.2:61886
Apr 02, 2015 9:42:39 AM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [10.0.2.15]:5701 [test] [3.4.2] Established socket connection between /172.17.0.3:5701 and 10.0.2.2/10.0.2.2:61886
Apr 02, 2015 9:42:39 AM com.hazelcast.client.impl.client.AuthenticationRequest
INFO: [10.0.2.15]:5701 [test] [3.4.2] Received auth from Connection [/172.17.0.3:5701 -> 10.0.2.2/10.0.2.2:61886], endpoint=null, live=true, type=JAVA_CLIENT, successfully authenticated
source of the container definition available at: https://github.com/looztra/dockerfiles/tree/master/deb-hazelcast/3.4.2
package hazelcast;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
public class Client1 {
public static void main(String[] args) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getGroupConfig().setName("test").setPassword("test_pass");
//clientConfig.getNetworkConfig().addAddress("172.17.0.128");
//clientConfig.getNetworkConfig().addAddress("10.0.2.15");
clientConfig.getNetworkConfig().addAddress("127.0.0.1");
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
System.out.println("Setting values in the Hazelcast instance");
IMap<String, String> mapCustomers = client.getMap("customers"); // creates the map proxy
mapCustomers.put("1", "Joe_Smith");
mapCustomers.put("2", "Ali_Selam");
mapCustomers.put("3", "Avi_Noyan");
}
}
#!/usr/bin/env bash
MIN_HEAP=${MIN_HEAP:=1G}
MAX_HEAP=${MAX_HEAP:=1G}
MANCENTER_ENABLED=${MANCENTER_ENABLED:=false}
MANCENTER_URL=${MANCENTER_URL:=http://mancenter:8080/mancenter/}
GROUP_NAME=${GROUP_NAME:=dev}
GROUP_PASS=${GROUP_PASS:=devpass}
PUBLIC_ADDRESS=${PUBLIC_ADDRESS:=`ip addr show eth0 | grep inet | grep -v inet6 | cut -d " " -f 6 | cut -d"/" -f1`}
java -Xms$MIN_HEAP -Xmx$MAX_HEAP -Dpublic.address=$PUBLIC_ADDRESS -Dgroup.name=$GROUP_NAME -Dgroup.pass=$GROUP_PASS -Dmancenter.enabled=$MANCENTER_ENABLED -Dmancenter.url=$MANCENTER_URL -Djava.net.preferIPv4Stack=true -Dhazelcast.config=/opt/hazelcast/hazelcast.xml -cp "/opt/hazelcast/lib/hazelcast.jar" com.hazelcast.core.server.StartServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment