[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Cannot get distributed caching to work with RMI  XML
Forum Index -> Ehcache
Author Message
chump

journeyman

Joined: 10/28/2009 19:48:06
Messages: 11
Offline

Hi,

I'm experimenting with EhCache version 1.7.0.

I have two processes, one writing objects and one listening for them with a CacheEventListener.

Both have identical ehcache.xml config files as follows:

Code:
 <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"       properties="peerDiscovery=automatic,multicastGroupAddress=239.255.0.1,multicastGroupPort=4446,timeToLive=0" propertySeparator=","/>
 
 <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
     
 <cache name="myCache"
             maxElementsInMemory="100000"
             eternal="true"
             overflowToDisk="false">
 
         <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
 


However, the data in the cache is not being distributed between the two processes. I have run the EhCache Debugger and upped the log level. No matter whether or not my two servers are running, I always seem to get this from the debugger:

"FINE: 1 RMICachePeers bound in registry for RMI listener"

Then I continuously get these:
Cache: myCache Notifications received: 0 Elements in cache: 0

However, my process is continuously putting new objects into the cache - they just do not appear to be detected by either the debugger, or my listening process - its CacheEventListener doesn't get called and cache.getSize() returns 0.

Can anyone suggest what is wrong?


Thanks



gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

Ok, you are not getting anything. If you were the notifications received would increment.

Try turning up net.sf.ehcache.distribution logging level to FINE and past that to this forum.

The most likely causes of trouble are:

1) something wrong with multicast. Try running both processes on the same box to rule out something blocking multicast.

2) Try ehcache 1.6.2. The debugger has not yet been released against 1.7. Not sure if it is the cause but we have not validated it yet.
chump

journeyman

Joined: 10/28/2009 19:48:06
Messages: 11
Offline

Thanks for your reply.

I am running both processes on the same box.

I tried switching to version 1.6.2 of ehcache but I get the same problem.

Attached is the log from the debugger.


Thanks
 Filename ehcache-debug.log [Disk] Download
 Description
 Filesize 27 Kbytes
 Downloaded:  183 time(s)

ericlma

neo

Joined: 10/15/2009 09:31:59
Messages: 6
Offline

So you are using "automatic" RMI, which does multicast behind the scenes. Have you checked whether multicast works?

Here is my ehcache.xml that works, using "manual" RMI:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<diskStore path="java.io.tmpdir"/>

<cacheManagerEventListenerFactory class="" properties=""/>

<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//server1:40000/tableColumn
|//server2:40000/tableColumn"
propertySeparator="," />
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=server1,
port=40000,
socketTimeoutMillis=120000"
propertySeparator=","/>

<defaultCache
maxElementsInMemory="20000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="300"
overflowToDisk="true"
diskSpoolBufferSizeMB="50"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="tableColumn"
maxElementsInMemory="20000"
eternal="true"
timeToIdleSeconds="432000"
timeToLiveSeconds="432000"
overflowToDisk="true">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
</cache>
</ehcache>
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1465
Offline

The issue seems to be resolved.Please let know in case of more information.

Rakesh Joshi
Terracotta.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team