Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReplicatedMap not configured properly #8298

magiccrafter opened this issue Jun 2, 2016 · 2 comments


None yet
3 participants
Copy link

commented Jun 2, 2016

ReplicatedMap is being miss-configured as IMap.
This can be easily verified after application startup in jmx client such as java mission control.
The section for ReplicatedMap is there and the map as well but after checking the MBean's attributes of the map it turns out that the "config" attribute contains the properties of an IMap one:

MapConfig{name='default'', inMemoryFormat=BINARY', backupCount=1, asyncBackupCount=0, timeToLiveSeconds=0, maxIdleSeconds=0, evictionPolicy='NONE', evictionPercentage=25, minEvictionCheckMillis=100, maxSizeConfig=MaxSizeConfig{maxSizePolicy='PER_NODE', size=2147483647}, readBackupData=false, hotRestart=HotRestartConfig{enabled=false, fsync=false}, nearCacheConfig=null, mapStoreConfig=MapStoreConfig{enabled=false, className='null', factoryClassName='null', writeDelaySeconds=0, writeBatchSize=1, implementation=null, factoryImplementation=null, properties={}, readOnly=null, initialLoadMode=LAZY, writeCoalescing=true}, mergePolicyConfig='', wanReplicationRef=null, entryListenerConfigs=[], mapIndexConfigs=[], mapAttributeConfigs=[], quorumName=null, queryCacheConfigs=[], cacheDeserializedValues=INDEX_ONLY} String config -1 MapConfig

I believe this is the reason why when using declarative annotation-based caching (i.e. @Cacheable) in the Spring based application leads to creation of another IMap with same "default" name and the ReplicatedMap is never used.

Configuration (Spring Programmatic):

public class HazelcastInstanceConfig {

    /** Helper constants */
    private static final String HZ_MEMBERS_SEPARATOR = ",";

    /** Hazelcast Maps */
    public static final String REPL_MAP = "test";

    private EntrySerializableFactory entrySerializableFactory;

    public CacheManager cacheManager() {
        return new HazelcastCacheManager(hazelcastInstance());

    public HazelcastInstance hazelcastInstance() {
        Config config = new Config();

        String clusterName = getClusterName();

        NetworkConfig network = config.getNetworkConfig();
        JoinConfig join = network.getJoin();
        TcpIpConfig tcpIpConfig = join.getTcpIpConfig();

        config.addReplicatedMapConfig(new ReplicatedMapConfig().setName(REPL_MAP)

                EntrySerializableFactory.FACTORY_ID, entrySerializableFactory);

        return Hazelcast.newHazelcastInstance(config);

    protected String getClusterName() {
        return hzProperties.getGroupName();

This comment has been minimized.

Copy link

commented Jun 2, 2016

For clarity here is the picture that visualizes exactly how it looks like:

@jerrinot jerrinot added this to the 3.7 milestone Jun 2, 2016

@pveentjer pveentjer self-assigned this Jun 7, 2016


This comment has been minimized.

Copy link

commented Jun 7, 2016

The problem is in the ReplicatedMapMBean:


    public String getConfig() {
        return service.instance.getConfig().findMapConfig(managedObject.getName()).toString();


    public String getConfig() {
        return service.instance.getConfig().findReplicatedMapConfig(managedObject.getName()).toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.