Hibernate 异常CacheException: Another unnamed CacheManager already exists in the same VM
原因:
ehcache在2.5以后,CacheManager使用了Singleton,这样在创建多个CacheManager时就会产生上述错误。
解决方法:
把
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
改成
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.SingletonEhCacheRegionFactory
</property>
还没有评论,来说两句吧...