CacheManager Loading issues

Source: Internet
Author: User

Net.sf.ehcache.CacheException:Another unnamed CacheManager already exists in the same VM. Provide unique names for each cachemanager in the config or do one of the following:

The system will create CacheManager, but no beanid, cannot be injected to get chachemanager, with ehcache.xml into the src root directory, you can automatically create the cache,
If you are in any directory, you can add listener under Web. XML to create a cachemanage with the file creation cache


use Shiro ehcachecachemanager, because the system can only create a ehcachecachemanager

so you want to create your own and system from the same place, even if you use the Classpath path through the Ehcache.xml configuration,

Then let yourself and the system point to it, the file name must be Ehcache.xml

<bean id= "Ehcachemanager"
class= "Org.springframework.cache.ehcache.EhCacheManagerFactoryBean" >
<property name= "configlocation" value= "Classpath:/ehcache.xml"/>
<property name= "Shared" value= "true"/>
</bean>

<bean id= "CacheManager" class= "Org.springframework.cache.ehcache.EhCacheCacheManager" >
<property name= "CacheManager" ref= "Ehcachemanager"/>
</bean>
<bean id= "Shirocachemanager" class= "Org.apache.shiro.cache.ehcache.EhCacheManager" >
<property name= "CacheManager" ref= "Ehcachemanager"/>
</bean>

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

CacheManager Loading issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.