Results 1 to 2 of 2

Thread: EhCacheFactoryBean & statistics enablement

  1. #1
    Join Date
    Nov 2010
    Posts
    16

    Default EhCacheFactoryBean & statistics enablement

    I'm running into a problem where I'm defining a cache through my XML configuration and the enabling of statistics is failing.

    I have a cache manager defined thusly
    Code:
    <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation" value="/WEB-INF/ehcache.xml" />
    </bean>
    And I then define the cache using this:
    Code:
    <bean id="dataServiceCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
        <property name="cacheManager" ref="ehcache" />
        <property name="cacheName" value="dataService" />
        <property name="memoryStoreEvictionPolicy" value="LRU" />
        <property name="maxElementsInMemory" value="100" />
        <property name="statisticsEnabled" value="true" />
    </bean>
    In my ehcache.xml, I have the defaultCache configured as
    Code:
    statistics="true"
    .

    However when I start the container, I get an illegal state exception indicating that the cache is STATUS_UNINITIALIZED. Using 3.1.1.RELEASE, this happens at EhCacheFactoryBean.createCache() line 365,
    which sets the statisticsEnabled property on the cache.

    At this point in the creation of the cache bean, the cache has not yet been registered with the cache manager and as such this property can not be set.

    Has anyone else encountered this issue? How much would be involved with getting this fixed?

    I can supply a patch indicating what i think /should/ be happening instead of the current operation.

  2. #2
    Join Date
    Nov 2010
    Posts
    16

    Default

    I did a little more digging on this and found that this has been caused by a change made to ehcache between 2.0.0 and 2.5.2 to add property change support on the properties in question.

    This unfortunately means that the createCache method bombs because the cache has not been initialized.

    I have filed a bug and contacted the developer who exposed the properties

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •