当我使用ehcache和Spring启动tomcat时,出现了这个错误。
Another CacheManager with same name 'cacheManager' already exists in the same VM. Please
provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same
CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
- Spring 3.1(版本)
- ehcache 2.9.0(版本)
- 没有使用测试上下文。
- 这是一个Web JSF应用程序。
ehcache.xml
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true"
monitoring="autodetect"
dynamicConfig="true"
name="ehcacheManager"
>
....
</ehcache>
cache-context.xml
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" scope="singleton">
<property name="shared" value="true"/>
<property name="configLocation">
<value>classpath:ehcache.xml</value>
</property>
</bean>
我有一个旧的依赖项hibernate-ehcache,不幸的是我无法删除它。这可能是问题所在吗?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.5.0-Final</version>
</dependency>
有什么建议吗? 谢谢!