嘗試在Amazon EC2上的兩臺JBoss 4.2服務器之間創建一個基於EHCache的基於RMI的緩存複製。目前,這被設置爲手動對等發現,具有從Server2到Server1的單向複製。EHCache JBoss/EC2上的RMI複製拋出java.rmi.NoSuchObjectException:表中沒有這樣的對象
配置爲下:
服務器1
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=host1, port=40001,
socketTimeoutMillis=3000"/>
<cache name="cache1"
maxElementsInMemory="0"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="600"
timeToLiveSeconds="600"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="60"
statistics="true">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicatePuts=false, replicateUpdates=false,
replicateRemovals=false"/>
</cache>
服務器2
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//host1:40001/cache1"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=host2, port=40002,
socketTimeoutMillis=3000"/>
<cache name="cache1"
maxElementsInMemory="0"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="7200"
timeToLiveSeconds="7200">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=false"/>
</cache>
然而,當我把新元素融入到Server2上的高速緩存,它拋出以下異常:
Jul 10, 2012 3:25:37 PM net.sf.ehcache.distribution.RMISynchronousCacheReplicator replicatePutNotification
SEVERE: Exception on replication of putNotification. no such object in table. Continuing...
java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at net.sf.ehcache.distribution.RMICachePeer_Stub.put(Unknown Source)
at net.sf.ehcache.distribution.RMISynchronousCacheReplicator.replicatePutNotification(RMISynchronousCacheReplicator.java:149)
at net.sf.ehcache.distribution.RMISynchronousCacheReplicator.notifyElementPut(RMISynchronousCacheReplicator.java:132)
at net.sf.ehcache.event.RegisteredEventListeners.notifyListener(RegisteredEventListeners.java:294)
at net.sf.ehcache.event.RegisteredEventListeners.invokeListener(RegisteredEventListeners.java:284)
at net.sf.ehcache.event.RegisteredEventListeners.internalNotifyElementPut(RegisteredEventListeners.java:144)
at net.sf.ehcache.event.RegisteredEventListeners.notifyElementPut(RegisteredEventListeners.java:122)
at net.sf.ehcache.Cache.notifyPutInternalListeners(Cache.java:1515)
at net.sf.ehcache.Cache.putInternal(Cache.java:1490)
at net.sf.ehcache.Cache.put(Cache.java:1417)
at net.sf.ehcache.Cache.put(Cache.java:1382)
我也嘗試過使用Server2作爲獨立的Java程序(使用與上面所示相同的ehcache.xml)而不是JBoss服務器。但只要Server1是JBoss服務器,我就會看到這個例外。
如果我在同一主機上部署Server1和Server2(JBoss或Java程序),它會很好用。但只要我將它們移到不同的主機上,它就會死在我身上。
任何幫助將不勝感激。謝謝...