hazelcast-docker-swarm-discovery-spi icon indicating copy to clipboard operation
hazelcast-docker-swarm-discovery-spi copied to clipboard

Cannot find a matching constructor for MemberAddressProvider.

Open njoliveira opened this issue 5 years ago • 5 comments

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 ?

njoliveira avatar Feb 17 '20 15:02 njoliveira

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 avatar Feb 21 '20 11:02 stroebs

@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

stroebs avatar Feb 21 '20 12:02 stroebs

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

bitsofinfo avatar Feb 21 '20 16:02 bitsofinfo

@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

bitsofinfo avatar Feb 21 '20 16:02 bitsofinfo

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.

stroebs avatar Feb 22 '20 06:02 stroebs