首页 > 代码库 > shiro与spring集成时报Versions of Ehcache before version 2.5 allowed any number of CacheManagers with the same name (same configuration resource) to exist in a JVM.

shiro与spring集成时报Versions of Ehcache before version 2.5 allowed any number of CacheManagers with the same name (same configuration resource) to exist in a JVM.

shiro与spring集成时,一直报Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: InputStreamConfigurationSource [stream=java.io.BufferedInputStream@1b4ca1]

解决方法:把ehcache的jar包改成2.5前的,原因是2.5后CacheManager使用了单例.

顺便吐槽一下,现在百度一下问题,千篇一律的答案,全是复制别人的,没解释不说还不注明出处.

有需要的可以去看下那位博主所说的原因,地址为:http://blog.csdn.net/u013147600/article/details/48133913

 

shiro与spring集成时报Versions of Ehcache before version 2.5 allowed any number of CacheManagers with the same name (same configuration resource) to exist in a JVM.