Another unnamed CacheManager already exists in the same VM (ehCache 2.5) 解决办法
来源:互联网 发布:区块链卿毅 知乎 编辑:程序博客网 时间:2024/05/24 04:51
vm中存在2个CacheManager导致报错,百度了一下,大部分都是建议换成2.4的版本来解决问题,因为2.5以后不允许vm中存在2个实例。但是我就是非要用2.5那,该怎么办? 因为我要在自己的业务逻辑中操作CacheManager,我的配置文件代码如下:
<cache:annotation-driven/> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache" /> <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:config-location="classpath:ehcache.xml" />
<mapper namespace="com.raymon.cloudq.dao.WindowCurrentStateMapper" > <cache type="org.mybatis.caches.ehcache.EhcacheCache" eviction="FIFO" flushInterval="60000" size="512" readOnly="true"/>
mybatis配置缓存,查看源码后,发现会重新创建一个CacheManager。如下:
//// Source code recreated from a .class file by IntelliJ IDEA// (powered by Fernflower decompiler)//package org.mybatis.caches.ehcache;import java.util.concurrent.locks.ReadWriteLock;import net.sf.ehcache.CacheManager;import net.sf.ehcache.Ehcache;import net.sf.ehcache.Element;import org.apache.ibatis.cache.Cache;public abstract class AbstractEhcacheCache implements Cache { protected static CacheManager CACHE_MANAGER = CacheManager.create();
终于在stackoverflow找到答案,只需要配置
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:shared="true"/>
EhCacheManagerFactoryBean p:shared设置为true即可。
阅读全文
0 0
- Another unnamed CacheManager already exists in the same VM (ehCache 2.5) 解决办法
- Another unnamed CacheManager already exists in the same VM
- Another unnamed CacheManager already exists in the same VM.解决方法
- Another unnamed CacheManager already exists in the same VM
- Another unnamed CacheManager already exists in the same VM.解决方法
- net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM.
- Ehcache配置时出错- Another unnamed CacheManager already exists in the same VM. Please provide unique name
- Hibernate 异常CacheException: Another unnamed CacheManager already exists in the same VM
- SpringBoot--P-1:缓存 Another unnamed CacheManager already exists in the same VM.
- Ehcache依赖版本问题:Another CacheManager with same name 'es' already exists in the same VM.
- 在整合springmvc+mybatis+ecache时候报错如下: Another unnamed CacheManager already exists in the same VM.
- net.sf.ehcache.CacheException: Another unnamedCacheManager already exists in the same VM
- Springmvc中配置ehcache遇到错误Another CacheManager with same name
- Socket file /var/lib/mysql/mysql.sock exists. Is another MySQL daemon already running with the same
- Socket file /tmp/mysql.sock exists. Is another MySQL daemon already running with the same unix socke
- svn 如果遇到an unversioned directory of the same name already exists的解决办法
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- 【ML算法】KNN算法
- 作为函数的mixin
- addpath(genpath(pwd))
- Jquery EasyUI入门
- CountDownLatch理解:与join的区别
- Another unnamed CacheManager already exists in the same VM (ehCache 2.5) 解决办法
- [Opt 31-67] Problem
- Robotframework自定义库--读写本地的.txt文件
- Less的嵌套规则
- Redhat6.9的yum软件源更换为163的yum软件源
- Dagger2从入门到放弃再到恍然大悟
- Java并发编程:线程池的使用
- 拦截器
- SSIS Passing Parameters to an ADO .NET Source query;向ado.net数据源传递参数。