0 Replies Latest reply on Jul 10, 2012 6:58 PM by nmenon

    EHCache RMI Replication on JBoss/EC2 throws java.rmi.NoSuchObjectException: no such object in table

    nmenon

      Trying to create an EHCache RMI-based cache replication between 2 JBoss 4.2 servers on Amazon EC2. Currently, this is set up as manual peer discovery with one-way replication from Server2 to Server1.

       

       

      Configuration as under:

       

       

      Server 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>
      

       

       

      Server 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>
      

       

       

      However, when I put new elements into the cache on Server2, it throws the following exception:

       

      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)
      

       

      I've also tried this with Server2 as a stand-alone Java program (using the same ehcache.xml as shown above) instead of a JBoss server. But as long as Server1 is a JBoss server, I see this exception.

       

       

      It works great if I deploy Server1 and Server2 (JBoss or Java program) on the same host. But as soon as I move them to different hosts, it dies on me.

       

       

      Any help will be greatly appreciated. Thanks ...