Search code examples
javarmiehcachedistributed-cachingwildfly-8

Ehcache RMI replication works only in one way


I have a Jboss Wildfly 8.0.0 cluster with master and one slave. Ehcache is configured for RMI replication with manual option.

The issue is replication happens only in one direction. Replication from master to slave Jboss is working fine. There is no replication from slave Jboss to master JBoss.

I validate the cache details with Jconsole and I can see the one way replication. I can see the cache is getting created in both master and slave, issue is one way replication.

My master Jboss is in a VM Windows server 2012, slave JBoss is on windows 8.0 desktop I don’t see any errors in my JBoss console.

On Master ehcache.xml:

<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//myslave:40002/userAddress"/>


<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40001,
socketTimeoutMillis=30000"/>



<cache name="userAddress" eternal="true" overflowToDisk="true" maxEntriesLocalHeap="1" memoryStoreEvictionPolicy="LRU" >

        <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
        replicateUpdatesViaCopy=false, replicateRemovals=true "/>
</cache>

On Slave ehcache.xml:

<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//mymaster:40001/userAddress"/>

<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40002,
socketTimeoutMillis=30000"/>



<cache name="userAddress" eternal="true" overflowToDisk="true" maxEntriesLocalHeap="1" memoryStoreEvictionPolicy="LRU" >

        <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
        replicateUpdatesViaCopy=false, replicateRemovals=true "/>

</cache>

Solution

  • The firewall on master JBoss server was blocking the replication to the master. Issue is resolved. It is worth to read this article in similar cases, it gives more idea on 'remoteObjectPort'.