Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ehcache exception #27

Open
linpingchuan opened this issue Sep 5, 2016 · 0 comments
Open

ehcache exception #27

linpingchuan opened this issue Sep 5, 2016 · 0 comments

Comments

@linpingchuan
Copy link

<!-- 缓存管理器 使用Ehcache实现 -->
    <bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
        <property name="cacheManagerConfigFile" value="classpath:ehcache.xml"/>
    </bean>

在Ehcache version2.5之后将会出现以下异常

Caused by: net.sf.ehcache.CacheException: Another unnamed 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.

建议修正为以下配置

<!-- 缓存管理器 使用Ehcache实现 -->
    <bean id="cache"
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="shared" value="true" />
    </bean>
    <bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"
        init-method="init" destroy-method="destroy">
        <property name="cacheManagerConfigFile" value="classpath:ehcache.xml" />
        <property name="cacheManager" ref="cache" />
    </bean>

XML问题详情页面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant