加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

java – Spring Ehcache MBean Monitoring

发布时间:2020-12-15 01:49:53 所属栏目:大数据 来源:网络整理
导读:我使用的是Spring 4.0.3.RELEASE和EHcache 2.8.1.在JBoss 7.1.1上 通过applicationContext.xml中的以下配置,我的缓存工作正常. 现在我想用MBean添加监视功能.我在applicationContext.xml中更改了配置,如下所示 添加了2个新bean“managementService”和“mbea

我使用的是Spring 4.0.3.RELEASE和EHcache 2.8.1.在JBoss 7.1.1上

通过applicationContext.xml中的以下配置,我的缓存工作正常.

现在我想用MBean添加监视功能.我在applicationContext.xml中更改了配置,如下所示 – 添加了2个新bean“managementService”和“mbeanServer”,没有其他更改.
这是当前配置.

使用此配置,我在应用程序服务器启动时收到以下错误.

14:05:32,208 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factory.UnsatisfiedDependencyException: **Error creating bean with name 'managementService'** defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [net.sf.ehcache.CacheManager]: Could not convert constructor argument value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]: Failed to convert value of type 'org.springframework.cache.ehcache.EhCacheCacheManager' to required type 'net.sf.ehcache.CacheManager'; nested exception is java.lang.IllegalStateException: **Cannot convert value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]**: no matching editors or conversion strategy found

Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'managementService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [net.sf.ehcache.CacheManager]: Could not convert constructor argument value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]: Failed to convert value of type 'org.springframework.cache.ehcache.EhCacheCacheManager' to required type 'net.sf.ehcache.CacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]: no matching editors or conversion strategy found
最佳答案
您应该将ehcache bean传递给managementService bean的构造函数而不是cacheManager.如果查看cacheManager的定义,ehcache bean将作为cacheManager传递.工厂bean将提供net.sf.ehcache.CacheManager的实例.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读