{"action":"created","issue":{"url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16","repository_url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi","labels_url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16/comments","events_url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16/events","html_url":"https://github.com/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16","id":313785168,"number":16,"title":"NullPointerException on docker swarm","user":{"login":"tbolis","id":6574428,"avatar_url":"https://avatars2.githubusercontent.com/u/6574428?v=4","gravatar_id":"","url":"https://api.github.com/users/tbolis","html_url":"https://github.com/tbolis","followers_url":"https://api.github.com/users/tbolis/followers","following_url":"https://api.github.com/users/tbolis/following{/other_user}","gists_url":"https://api.github.com/users/tbolis/gists{/gist_id}","starred_url":"https://api.github.com/users/tbolis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbolis/subscriptions","organizations_url":"https://api.github.com/users/tbolis/orgs","repos_url":"https://api.github.com/users/tbolis/repos","events_url":"https://api.github.com/users/tbolis/events{/privacy}","received_events_url":"https://api.github.com/users/tbolis/received_events","type":"User","site_admin":false},"labels":[{"id":630638269,"url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-04-12T15:47:01Z","updated_at":"2018-04-13T17:51:37Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm trying to setup my application to utilize your discovery spi but I'm getting the following error\r\n\r\n```\r\n2018-04-12 15:29:19.041  INFO 1 --- [           main] o.b.h.d.docker.swarm.SwarmDiscoveryUtil  : Found relevant docker network: dev_my-network[uldk9khisx2bbvobda99tcwxz]\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | 2018-04-12 15:29:19.223 ERROR 1 --- [           main] com.hazelcast.instance.AddressPicker     : [LOCAL] [dev] [3.9.3] null\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    |\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | java.lang.NullPointerException: null\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat org.bitsofinfo.hazelcast.discovery.docker.swarm.SwarmMemberAddressProvider.getBindAddress(SwarmMemberAddressProvider.java:126)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.DelegatingAddressPicker.pickAddress(DelegatingAddressPicker.java:62)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.Node.<init>(Node.java:184)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.HazelcastInstanceImpl.createNode(HazelcastInstanceImpl.java:160)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:128)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:195)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:174)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:124)\r\nserver.1.nzo2mv8x8a6e@linuxkit-025000000001    | \tat com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:58)\r\n```\r\n\r\nI follow instructions from Option 1 in your instructions and I setup a `SwarmMemberAddressProvider` programmatically.\r\n\r\n```\r\n NetworkConfig nconf = config.getNetworkConfig();\r\n            JoinConfig jconf = nconf.getJoin();\r\n\r\n            nconf.setMemberAddressProviderConfig(new MemberAddressProviderConfig()\r\n                    .setEnabled(true)\r\n                    .setClassName(SwarmMemberAddressProvider.class.getName())\r\n            ); \r\n\r\n...\r\n\r\n\r\nMap<String,Comparable> properties = new HashMap<>();\r\nproperties.put(\"docker-network-names\",\"my-network\");\r\nproperties.put(\"docker-service-names\",\"server\");\r\nproperties.put(\"swarm-mgr-uri\",\"http://socat:2375\");\r\n\r\nDiscoveryStrategyConfig sconf = new DiscoveryStrategyConfig(DockerSwarmDiscoveryStrategy.class.getName(),properties);\r\n\r\n```\r\n\r\nI'm playing on a OSX machine therefore I utilize bobrik/socat \r\n\r\n```YAML\r\nversion: '3.5'\r\nvolumes:\r\n  server_data:\r\nnetworks:\r\n  my-network:\r\nservices:\r\n  socat:\r\n    hostname: socat\r\n    image: bobrik/socat\r\n    volumes:\r\n    - /var/run/docker.sock:/var/run/docker.sock\r\n    ports:\r\n     - 2375:2375\r\n    command: TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock\r\n    networks:\r\n      - my-network\r\n    deploy:\r\n      placement:\r\n        constraints: [node.role == manager]\r\n  server:\r\n    hostname: server\r\n    image: <my image>\r\n    networks:\r\n      - my-network\r\n    ports:\r\n      - ${PORT:-8080}:8080\r\n      - ${HZ_PORT_RANGE:-5701-5801}:5701-5801\r\n    depends_on:\r\n      - socat\r\n    deploy:\r\n      replicas: 1\r\n\r\n```\r\n\r\nNote that from within the `server` container I get a reploy from `http://socat:2375/networks` normally\r\n\r\n> docker version: Docker version 18.03.0-ce, build 0520e24\r\n> hazelcast version: 3.9.3\r\n\r\nAny idea why is this happening? \r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/comments/381213091","html_url":"https://github.com/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16#issuecomment-381213091","issue_url":"https://api.github.com/repos/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/16","id":381213091,"user":{"login":"bitsofinfo","id":1743646,"avatar_url":"https://avatars1.githubusercontent.com/u/1743646?v=4","gravatar_id":"","url":"https://api.github.com/users/bitsofinfo","html_url":"https://github.com/bitsofinfo","followers_url":"https://api.github.com/users/bitsofinfo/followers","following_url":"https://api.github.com/users/bitsofinfo/following{/other_user}","gists_url":"https://api.github.com/users/bitsofinfo/gists{/gist_id}","starred_url":"https://api.github.com/users/bitsofinfo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitsofinfo/subscriptions","organizations_url":"https://api.github.com/users/bitsofinfo/orgs","repos_url":"https://api.github.com/users/bitsofinfo/repos","events_url":"https://api.github.com/users/bitsofinfo/events{/privacy}","received_events_url":"https://api.github.com/users/bitsofinfo/received_events","type":"User","site_admin":false},"created_at":"2018-04-13T17:51:37Z","updated_at":"2018-04-13T17:51:37Z","author_association":"OWNER","body":"Yes so your `properties.put(\"docker-service-names\",\"server\");` should instead be `properties.put(\"docker-service-names\",\"tbolis_server\");`"}}
{"actor":{"display_login":"bitsofinfo"}}