Ehcache RMI复制在带有tomcat的linux上不起作用,但在windows上工作正常?

发布于 2025-01-04 09:03:35 字数 1394 浏览 4 评论 0原文

我们已经在 Linux 上的两个系统上安装了服务器的两个实例,该服务器是一个 Web 应用程序(例如 SampleWebApp)。我们配置了 ehcache 来缓存本地数据,还配置了默认的 RMI 复制来将 Server1 上所做的更改复制到 Server2。复制在 Windows 环境中工作正常,但在 Linux 环境中不起作用。即使没有打印任何错误,它也会默默地失败。

ehcache.xml 文件中完成的配置如下 -

    <cacheManagerPeerProviderFactory              class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
    properties="peerDiscovery=manual,
    rmiUrls=//<ip>:50000/sampleReplicatedCache"
    propertySeparator="," />
    <cacheManagerPeerListenerFactory             class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"   properties="port=40000"/>
    <cache name="cmServerReplicatedCache" maxElementsInMemory="100" eternal="true"
    memoryStoreEvictionPolicy="LRU" >
    <cacheEventListenerFactory       class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
    properties="replicateAsynchronously=true, replicatePuts=true,
    replicatePutsViaCopy=true, replicateUpdates=true, replicateUpdatesViaCopy=true,           replicateRemovals=false,   asynchronousReplicationIntervalMillis=5000"/>
    <bootstrapCacheLoaderFactory      class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
    </cache>

没有安装可能阻止复制的防火墙,因此防火墙不是失败的原因。 还检查端口是否打开。分配的50000端口被打开,Ehcache监听该端口。问题是,如果缓存中有更新,则此更改不会被复制。

对此的任何建议或澄清将不胜感激。

谢谢, 想知道!

we are have installed two instances of a server which is a web application say SampleWebApp on two systems on linux. We have configured ehcache to cache local data and also a default RMI replication to replicate changes done on Server1 to Server2. The replication works fine on Windows environment but it does not work on Linux environment. Even there is no error printed, it fails silently.

The configurations done in ehcache.xml file are below-

    <cacheManagerPeerProviderFactory              class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
    properties="peerDiscovery=manual,
    rmiUrls=//<ip>:50000/sampleReplicatedCache"
    propertySeparator="," />
    <cacheManagerPeerListenerFactory             class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"   properties="port=40000"/>
    <cache name="cmServerReplicatedCache" maxElementsInMemory="100" eternal="true"
    memoryStoreEvictionPolicy="LRU" >
    <cacheEventListenerFactory       class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
    properties="replicateAsynchronously=true, replicatePuts=true,
    replicatePutsViaCopy=true, replicateUpdates=true, replicateUpdatesViaCopy=true,           replicateRemovals=false,   asynchronousReplicationIntervalMillis=5000"/>
    <bootstrapCacheLoaderFactory      class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
    </cache>

There is no firewall installed which could block replication so firewall is not a reason why it is failing.
Also checked if ports are opened. Allocated port 50000 is opened and Ehcache listens to this port. Problem is that if there is update in cache, this change is not getting replicated.

Any suggestions or clarifications on this will be appreciated.

Thanks,
Wonder!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月下客 2025-01-11 09:03:35

这个问题就解决了。忘记发布答案了。问题是我在 ehcache.xml 中使用了令牌,但 ehcache.xml 文件不支持 spring 表达式解析器(使用 ${} 进行令牌替换),因为该文件不在 spring 应用程序上下文中。我用实际值替换了令牌,然后它就起作用了

This problem is solved. Forgot to post the answer. Issue was that I was using tokens in ehcache.xml but spring expression resolver (token replacement using ${}) is not supported in ehcache.xml file since the file does not come under spring application context. I replaced the tokens with actual values and then it worked

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文