I am using hibernate and spring along with ehcache. I've configured a number of cache elements in ehcache.xml with the same basic details.
For example:
Code:
<cache name="theCacheName"
eternal="false"
timeToIdleSeconds="1500"
timeToLiveSeconds="1500"
statistics="true"
maxElementsInMemory="30000" />
I've also enabled REST management service with this line:
Code:
<managementRESTService enabled="true"/>
I've configured hibernate to use ehcache as second level cache:
Code:
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.generate_statistics" value="true"/>
<property name="hibernate.cache.provider_configuration_file_resource_path" value="ehcache.xml"/>
Now when I start the Terracotta Management Console I can connect to the LocalConnectionGroup, I can see each of the cache instances I defined. (e.g. theCacheName) and I can view the configuration data for each.
However when I look at the overview the hit ratio, hit rate, miss rate, size etc... are zero for all of them even though by looking at the hibernate logs/mbean entry I can tell that the 2nd level cache is being hit as expected.
So it seems the cache is setup and working correctly but the statistics are not being populated.
Similarly I tried to monitor through jmx using JConsole and VisualVM, I can see each cache instance and the configuration details of each. But the statistics are "Unavailable".
If I hover over the "Unavailable" value in VisualVM for statistics it indicates that net.sf.ehcache.statistics.StatisticsGateway threw a java.io.NotSerializableException / java.io.WriteAbortedException
Any theories or suggestions would be greatly appreciated, I've been banging my head on this for a while.