我正在尝试开发一个grails 2.4.X插件来添加域对象。当我运行我的应用程序时,我在应用程序中得到了这个,包括插件:
Caused by 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.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
->> 628 | assertNoCacheManagerExistsWithSameName in net.sf.ehcache.CacheManager
我认为DataSource和Config(在插件中)被覆盖了。
我更新了用于使用BeanEhcacheRegionFactory4的插件:
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
// cache.region.factory_class = 'net.sf.ehcache.hibernate.BeanEhcacheRegionFactory' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.BeanEhcacheRegionFactory4' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}
Grails ehcache plugin - Another unnamed CacheManager already exists in the same VM
我没有ehcache.xml所以我假设它正在使用groovy配置。
通过移动到2.5 / 3可以解决这个问题吗?
删除ehcache插件“修复”了这个问题。