當使用ehcache和Spring啓動tomcat時收到此錯誤。具有相同名稱'cacheManager'的另一個CacheManager已經存在於同一虛擬機中
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.
- 春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>
緩存的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>
我有老依賴冬眠-ehcache的,很遺憾,我不能刪除。這可能是問題嗎?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.5.0-Final</version>
</dependency>
有什麼建議嗎? 謝謝!
感謝您的回答。我之前檢查過這些。我的ehcache.xml有一個名字。調試我發現上下文可能會被加載兩次,我不確定,我看到的是嘗試註冊具有相同名稱的同一個cacheManager。 –