Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
Spring Modules Cache + Hibernate 2nd-level cache Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Modules Cache + Hibernate 2nd-level cache

    Hi guys,

    We've been using Spring Modules to cache some JDBC DAOs for a while now with great success. Now we are slowly starting to migrate some DAOs to use JPA/Hibernate instead and we'd like to cache some of those too. For this we figured that using the Hibernate second-level cache would be appropriate and so we tried configuring it. Unfortunately we now end up with an EHCache (our cache provider) exception which looks like that:

    net.sf.ehcache.CacheException: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "C:\DOCUME~1\RU9211~1\LOCALS~1\Temp\" which is already used by an existing CacheManager. The source of the configuration was classpath.
    I guess this exception is natural, since two different libraries are trying to use and configure EHCache as their cache provider: Hibernate and Spring Modules. My question is: how can we adapt our current setup so that both these libraries can use EHCache?

    Our persistence.xml:

    <persistence xmlns=""
    	<persistence-unit name="promoPersistenceUnit"
    			<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
                <property name="hibernate.cache.use_second_level_cache" value="true" />
    			<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
    and part of our applicationContext.xml:

    	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
    	<bean id="cacheProvider" class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
    		<property name="cacheManager" ref="cacheManager" />
    Thanks a lot!