I am using Ehcache caching with spring
configuration. I need to monitor the Ehcache
object in jconsole-mbeans or jvisualvm, but i don't see ehcache mbeans under jconsole.
I have also mentioned
statistics="true
like below
..........
I am using Ehcache caching with spring
configuration. I need to monitor the Ehcache
object in jconsole-mbeans or jvisualvm, but i don't see ehcache mbeans under jconsole.
I have also mentioned
statistics="true
like below
..........
You can try to enable it in the code.
CacheManager manager = CacheManager.getCacheManager("CacheName");
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true);
We need to to register ehcache with managed beanserver also like below
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true" />
</bean>
<bean id="managementService"
class="net.sf.ehcache.management.ManagementService"
init-method="init"
destroy-method="dispose">
<constructor-arg ref="ehcache"/>
<constructor-arg ref="mbeanServer"/>
<constructor-arg index="2" value="true"/>
<constructor-arg index="3" value="true"/>
<constructor-arg index="4" value="true"/>
<constructor-arg index="5" value="true"/>
</bean>
Your already must be having below entry in spring config xml
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="ehcache"/>
</bean>
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" scope="singleton">
<property name="configLocation" value="classpath:ehcache.xml" />
<property name="shared" value="true" />
</bean>