您的位置:首页 > 其它

Hibenate second-level ehcache

2015-11-03 10:35 411 查看
在公司运行好好的项目,拿到家里面运行 报了如下错误:

Another CacheManager with same name 'hibernate' already exists in the same VM。

经过Google,http://blog.sina.com.cn/s/blog_6e0810c701014dmv.html

http://stackoverflow.com/questions/18032771/hibernate-second-level-cache-junit

得出的结论是,需要配置 SingletonEhCacheRegionFactory 取代 EhCacheRegionFactory

<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>

替换为

<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory </prop>

结果确实是好使了,但是问题就出来了,为什么在公司环境用EhCacheRegionFactory,OK,而换个环境必须用SingletonEhCacheRegionFactory 呢?

他们之间的区别是什么?

http://stackoverflow.com/questions/6615790/singletonehcacheregionfactory-vs-ehcacheregionfactory

有对Ehcache精通的大牛,欢迎在评论区做详细的解释。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Hibernate Ehcache