Grails ehcache插件 - 另一个未命名的CacheManager已存在于同一个VM中 [英] Grails ehcache plugin - Another unnamed CacheManager already exists in the same VM

查看:230
本文介绍了Grails ehcache插件 - 另一个未命名的CacheManager已存在于同一个VM中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ehcache为我的第二级缓存运行我的Grails应用程序,它可以工作。我安装了 ehcache 插件+ 缓存插件,然后它没有。我尝试了几乎所有来自互联网的解决方案,但没有找到解决方案,我一直在获取另一个未命名的CacheManager已经存在于同一个VM中



其中一种可能的解决方案是在 EhCacheManagerFactoryBean 中设置 p:shared = true ,如果我使用旧的插件grails的springcache插件,但新插件他们使用该经理的修改版本,共享的属性不可用。



我试着定义新的 ehcache.xml 文件,但仍然无法为此缓存管理器添加新名称。



我尝试过在我的 DataSource.groovy 中更改 cache.provider 类以使用另一个 EhCacheProvider 比如 Singleton



不用说,我测试了使用DSL的不同名称在不同的地方,但仍然没有运气。



最后,我使用旧插件的春季缓存,这是d eprecated。任何人都可以帮忙吗?

我使用Grails 2.0.3和 ehcache-core:2.5.3

解决方案在 DataSource的 hibernate 部分。 groovy ,确保你的 cache.provider.class 是最新的:

  hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class ='grails.plugin.cache.ehcache.hibernate。 BeanEhcacheRegionFactory'//对于4.0之前的Hibernate
cache.region.factory_class ='grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory4'//对于4.0之前的Hibernate和
}

我有同样的问题,因为我的 cache.region.factory_class 过期: net.sf.ehcache.hibernate.EhCacheProvider



请参阅 http:// g rails-plugins.github.io/grails-cache-ehcache/guide/usage.html


I run my Grails application using ehcache for my 2nd level Cache and it works. I installed the ehcache plugin + cache plugin and then it doesn't. I tried almost all solutions from the internet and found no solution I keep getting Another unnamed CacheManager already exists in the same VM.

One of the possible solutions is to set p:shared=true in the EhCacheManagerFactoryBean, this works if I use an old plugin "springcache plugin from grails" but with the new plugin they use a modified version of this manager and the property shared is not available.

I tried defining a new ehcache.xml file but still I can not put inside a new name for this cache manager.

I tried changing the cache.provider class inside my DataSource.groovy to use one another EhCacheProvider such as a Singleton.

Needless to say, I tested putting a different name using DSL in different places but still no luck.

At the end I'm using the old plugin for spring cache which is deprecated. Can anybody help?

I'm using Grails 2.0.3 and ehcache-core:2.5.3.

解决方案

In the hibernate section of DataSource.groovy, make sure your cache.provider.class is up to date:

hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = true
    cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory' // For Hibernate before 4.0
    cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory4' // For Hibernate before 4.0 and higher
}

I had the same problem because my cache.region.factory_class was outdated: net.sf.ehcache.hibernate.EhCacheProvider.

See http://grails-plugins.github.io/grails-cache-ehcache/guide/usage.html

这篇关于Grails ehcache插件 - 另一个未命名的CacheManager已存在于同一个VM中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆