ehcache 冲突_ehcache版本冲突

本文讨论了EHCache从2.4.3到2.6.6版本的配置变化,导致的冲突问题。主要错误集中在"maxEntriesLocalHeap"属性上,该属性在旧版本中为"maxElementsInMemory"。解决方法包括使用不兼容属性的旧版本配置,或者升级到兼容新属性的EHCache版本。此外,还提到了与Spring集成时可能遇到的单例问题。
摘要由CSDN通过智能技术生成

以ehchache-core2.5为分水岭 缓存版本问题 版本不一样 配置不一样  ehcache-core-2.4.3.jar 与 ehcache-core-2.6.6

Caused by: net.sf.ehcache.CacheException: Error configuring from input stream. Initial  cause was null:9: Element does not allow attribute "maxEntriesLocalHeap".

at    net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:152)

at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:99)

... 30 more

Got the same problem with Spring, maxEntriesLocalHeap and maxEntriesLocalDisk threw the same exception. What seemed to work for me was using maxElementsInMemory and maxElementsOnDisk instead. Found them from javadoc.

Now, based on them being deprecated, I assume there was an older version of EHCache going on with my conf, as well as yours.

Based on this table, maxEntriesLocalHeap came on EHCache 2.5. Before that it was maxElementsInMemory. When I had trouble, I had used ehcache-spring-annotations, and as of this writing it is on version 1.2.0, coming with ehcache 2.4.5 - thus not supporting these properties.

After going for pure Spring config and explicit dependency to EHCache 2.5, problem went away and I was able to use the properties I originally intended to.

单例问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值