Another unnamed CacheManager already exists in the same VM.解决方法
2015-11-18 14:25
513 查看
最近在研究缓存框架Ehcache的配置和使用,我想根据多个ehcache.xml创建多个CacheManager对象,但是报了异常:
Caused by: net.sf.ehcache.CacheException: 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.
错误提示很明显:Ehcache不允许创建同样名称的CacheManager对象。如果我们没有ehcache.xml中配置CacaheManager的名称,那么默认的名称是__DEFAULT__。解决方式是<ehcache name="">中配置CacheManager的名称,并确保唯一。这样如下代码就不会报错了
第一个ehcache配置文件:
第二个ehcache配置文件:
Caused by: net.sf.ehcache.CacheException: 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.
错误提示很明显:Ehcache不允许创建同样名称的CacheManager对象。如果我们没有ehcache.xml中配置CacaheManager的名称,那么默认的名称是__DEFAULT__。解决方式是<ehcache name="">中配置CacheManager的名称,并确保唯一。这样如下代码就不会报错了
第一个ehcache配置文件:
第二个ehcache配置文件:
相关文章推荐
- 关于地图坐标标准的问题
- jquery 使用方法(一)
- 睡眠情况
- Python pip安装
- linux下利用backtrace追踪函数调用堆栈以及定位段错误
- Android轻量级开源缓存框架——ASimpleCache(ACache)源码分析
- Style和Theme
- 高并发系统中的常见问题
- "XX cannot be resolved to a type "eclipse报错及解决说明
- block,inline和inline-block概念和区别(转)
- hdfs一直处于safemode模式
- Java后台实时输出数据到页面
- mysql开启远程连接
- Ubuntu开机报错:could not update ICEauthority file /home/lstanding/.ICEauthority 并且不能进入开机页面
- Java中数据类型之间的转换
- android中在一个Activity中停留几秒后跳转至另外一个Activity
- System.Drawing.Color的颜色对照表(转载)
- python遍历数组的两种方法
- 欢迎使用CSDN-markdown编辑器
- android debug:Unable to add window -- token null is not for an application