bitsofinfo / hazelcast-docker-swarm-discovery-spi

Docker Swarm based discovery strategy SPI for Hazelcast enabled applications
Apache License 2.0
39 stars 33 forks source link

Cannot find a matching constructor for MemberAddressProvider. #50

Open njoliveira opened 4 years ago

njoliveira commented 4 years ago

In my hazelcast.xml I added a member-address-provider just like this (to test).

<member-address-provider enabled="true">
            <class-name>org.bitsofinfo.hazelcast.discovery.docker.swarm.SwarmMemberAddressProvider</class-name>

            <properties>
                <property name="dockerNetworkNames">...</property>
                <property name="dockerServiceLabels">...</property>
                <property name="dockerServiceNames">...</property>
                <property name="hazelcastPeerPort">...</property>
                <property name="swarmMgrUri">...</property>
                <property name="skipVerifySsl">true</property>
                <property name="logAllServiceNamesOnFailedDiscovery">true</property>
                <property name="strictDockerServiceNameComparison">true</property>
            </properties>

        </member-address-provider>

However, I am getting an error Cannot find a matching constructor for MemberAddressProvider. The member address provider has properties configured, but the class 'org.bitsofinfo.hazelcast.discovery.docker.swarm.SwarmMemberAddressProvider' does not have a public constructor accepting properties.

Can somebody help please ?

stroebs commented 4 years ago

Ditto. Cannot get this to work. Vert.X: 3.8.4
HazelCast: 3.12.2 SPI: 1.0-RC14

Slightly different error when I provide all keys via CLI arguments (-D): INFO: SwarmMemberAddressProvider.initialize() passed properties: dockerNetworkNames:xxx,yyy dockerServiceLabels:zzz dockerServiceNames:XXX-XXX swarmMgrUri:http://docksockprox:2375 skipVerifySsl:true hazelcastPeerPort:5701 logAllServiceNamesOnFailedDiscovery:false strictDockerServiceNameComparison:false

XXX-XXX.1.fffp279yom64@10-245-50-17    | com.hazelcast.config.ConfigurationException: Cannot find a matching constructor for MemberAddressProvider implementation 'org.bitsofinfo.hazelcast.discovery.docker.swarm.SwarmMemberAddressProvider'.
stroebs commented 4 years ago

@njoliveira Got it to work after fiddling a bit.

  1. Copy/paste the XML as-is and do not change it.
  2. Start your application and pass only the minimum required flags (dockerNetworkNames, dockerServiceNames, hazelcastPeerPort, swarmMgrUri)
  3. Profit
bitsofinfo commented 4 years ago

https://github.com/bitsofinfo/hazelcast-docker-swarm-discovery-spi/issues/49#issuecomment-541545777

bitsofinfo commented 4 years ago

@stroebs @njoliveira i rarely work on this project anymore but if there could be something improved in the code or docs to make this error more avoidable, please submit a PR for it along w/ docs. thanks

stroebs commented 4 years ago

Will look into doing so @bitsofinfo, thanks for the comment.

There's a weird combination of Java opts/flags that don't go well together, resulting in an empty set of containers which causes that error, due to the provider being unable to determine the container IP to listen on.