以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 <defaultCache> 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.
二
单例问题