ehcache2.5后hibernate多SessionFactory报错的解决
2016-11-13 10:07
330 查看
今天在项目中配置多SessionFactory,抛错
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在2.5以后,CacheManager使用了Singleton,这样在创建多个CacheManager时就会产生上述错误。
http://ehcache.org/documentation/get-started/concepts 是官方解释
解决方法是在Hibernate的hibernateProperties配置中,加上
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.SingletonEhCacheRegionFactory
</prop>
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在2.5以后,CacheManager使用了Singleton,这样在创建多个CacheManager时就会产生上述错误。
http://ehcache.org/documentation/get-started/concepts 是官方解释
解决方法是在Hibernate的hibernateProperties配置中,加上
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.SingletonEhCacheRegionFactory
</prop>
相关文章推荐
- ehcache2.5后hibernate多SessionFactory报错的解决(Another unnamed CacheManager )
- ehcache2.5后hibernate多SessionFactory报错的解决
- ehcache2.5后hibernate多SessionFactory报错的解决
- ehcache2.5后hibernate多SessionFactory报错的解决
- struts1.3 spring2.5 hibernate3.2问题解决过程
- hibernate反向工程无法选择sessionfactory解决办法
- Junit单元测试hibernate时解决多次创建SessionFactory
- spring整合hibernate,在获取sessionFactory的时候报错,求解决办法!!
- hibernate3与ehcache-2.8.3配合使用,在多个SessionFactory实例的情况下出现“Another unnamed CacheManager already exists in the same VM”问题
- Spring + MyBatis + Ehcache 整合 CacheManager 版本>2.5,命名空间冲突 解决
- Hibernate使用中sessionFactory的获取以及问题解决
- Spring定时器调用Hibernate方法无法获得SessionFactory的解决办法
- Another unnamed CacheManager already exists in the same VM (ehCache 2.5) 解决办法
- struts1.3 spring2.5 hibernate3.2问题解决过程
- 关于Hibernate 5 和 Hibernate 4 在创建SessionFactory的不同点分析(解决 org.hibernate.MappingException: Unknown entit
- 解决Weblogic 8.1和Hibernate 3的冲突
- 用hibernate编写程序遇到的问题及解决方法
- hibernate二级缓存攻略 Ehcache(from javaEyes)
- 关于Hibernate的DetachedCriteria查询的addOrder问题的解决办法
- hibernate中查询条件用参数的解决方法