java–Spring Ehcache MBean Monitoring

java–Spring Ehcache MBean Monitoring,第1张

概述我使用的是Spring 4.0.3.RELEASE和EHcache 2.8.1.在JBoss 7.1.1上通过applicationContext.xml中的以下配置,我的缓存工作正常.<cache:annotation-driven/> <bean id='cacheManager' class='org.springframework

我使用的是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 foundRelated 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的实例. 总结

以上是内存溢出为你收集整理的java – Spring Ehcache MBean Monitoring全部内容,希望文章能够帮你解决java – Spring Ehcache MBean Monitoring所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1269343.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)