【问题标题】:EhCache rmi replication issue in WebLogic clusterWebLogic 集群中的 EhCache rmi 复制问题
【发布时间】:2014-10-19 09:07:36
【问题描述】:

在将应用程序部署到 WebLogic 10.3.6 时,我遇到了 ehcache 复制问题。 应用程序未启动并引发以下异常:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehCacheManager' defined in class path resource [xxxxx.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //xxxx:xxxx/myCache. Initial cause was RemoteException occurred in server thread; nested exception is: 
    java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /x.x.x.x is non-local host
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    ...

Caused by: net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //xxxx:xxxx/myCache. Initial cause was RemoteException occurred in server thread; nested exception is: 
    java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /x.x.x.x is non-local host
    at net.sf.ehcache.distribution.RMICacheManagerPeerListener.notifyCacheAdded(RMICacheManagerPeerListener.java:538)
    at net.sf.ehcache.event.CacheManagerEventListenerRegistry.notifyCacheAdded(CacheManagerEventListenerRegistry.java:159)
    at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1118)
    at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:670)
    at net.sf.ehcache.CacheManager.init(CacheManager.java:372)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:294)
    at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:104)   
    ...

EhCache配置如下:

<diskStore path="java.io.tmpdir/myCache" />

<cacheManagerPeerProviderFactory
    class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
    properties="peerDiscovery=manual,rmiUrls=//x.x.x.x:xxxx/myCache" />                              

<cacheManagerPeerListenerFactory
    class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
    properties="hostName=x.x.x.x,port=xxxx,socketTimeoutMillis=300000" />

<cache 
    name="myCache" 
    maxElementsInMemory="1000"
    eternal="false"
    overflowToDisk="false" 
    diskPersistent="false"
    timeToIdleSeconds="0" 
    timeToLiveSeconds="1000"
    memoryStoreEvictionPolicy="LRU">
    <cacheEventListenerFactory 
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicatePuts=true,replicateUpdates=true,replicateRemovals=true,replicateUpdatesViaCopy=true,replicateAsynchronously=true" />
    <bootstrapCacheLoaderFactory 
        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" />
</cache>

感谢任何帮助。

【问题讨论】:

    标签: java spring replication ehcache weblogic-10.x


    【解决方案1】:

    我可以通过将缓存发现策略更改为自动和多播来使其正常工作。

    查看下面的工作配置:

    <cacheManagerPeerProviderFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
        properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,       
        multicastGroupPort=4447, timeToLive=32" />
    
    <cacheManagerPeerListenerFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
        properties="port=xxxx,socketTimeoutMillis=300000" />
    
    <cache 
        name="myCache" 
        maxElementsInMemory="1000"
        eternal="false"
        overflowToDisk="false" 
        diskPersistent="false"
        timeToIdleSeconds="0" 
        timeToLiveSeconds="1000"
        memoryStoreEvictionPolicy="LRU">
        <cacheEventListenerFactory 
            class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
        <bootstrapCacheLoaderFactory 
            class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
    </cache>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-07
      • 1970-01-01
      • 1970-01-01
      • 2013-10-02
      • 1970-01-01
      相关资源
      最近更新 更多