SPRINGMVC + Mybatis + Shiro + Ehcache when the cache manager error.

Source: Internet
Author: User

Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' Shirofilter ' defined in class Path resource [Spring/spring-shiro-web.xml]: Cannot resolve reference to beans ' securitymanager ' while setting bean Propert Y ' SecurityManager '; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' SecurityManager ' defined in class path resource [Spring/spring-shiro-web.xml]: Cannot resolve reference to bean ' Userrealm ' While setting beans property ' realm '; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Userrealm ' Defined in class path resource [Spring/spring-shiro-web.xml]: Cannot resolve reference-bean ' credentialsmatcher ' while Setting bean property ' Credentialsmatcher '; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Credentialsmatcher ' defined in class path resource [spring/spring-shiro-web.xML]: Cannot resolve reference to beans ' shirocachemanager ' while setting constructor argument; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Shirocachemanager ' defined in class path resource [Spring/spring-shiro-web.xml]: Cannot resolve reference to bean ' EhCache Manager ' while setting beans property ' CacheManager '; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' Ehcachemanager ' defined in class path resource [Spring/spring-shiro-web.xml]: Invocatio N of Init method failed; Nested exception is 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:


Finally red is the key, saying to make sure that the cache manager can only have one!

After shiro1.3, make sure that the cache manager is singleton.

So it needs to be fitted

<!--mybatis using Ehcache cache start--><bean id= "Ehcachemanager" class= " Org.springframework.cache.ehcache.EhCacheManagerFactoryBean "><property name=" configlocation "value=" Classpath:ehcache/shiroehcache.xml "/>                <property name=" shared "value=" true "></property> <!-- Here is the key!!! There is no need to be wrong  --></bean><!--end MyBatis use Ehcache cache--><!--Cache manager Ehcache Implementation--><bean id= " Shirocachemanager "class=" Org.apache.shiro.cache.ehcache.EhCacheManager "><property name=" CacheManager "ref= "Ehcachemanager"/></bean>

Full Configuration Document Address

http://download.csdn.net/detail/tragedyxd/9026633


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

SPRINGMVC + Mybatis + Shiro + Ehcache when the cache manager error.

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.