How to Solve the login error of Spring + Shiro CacheManager

I. Project start, login error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘shiroFilter’ defined in class path resource [spring-mvc.xml]: Cannot resolve reference to bean ‘securityManager’ while setting bean property ‘securityManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘securityManager’ defined in class path resource [spring-mvc.xml]: Cannot resolve reference to bean ‘sessionManager’ while setting bean property ‘sessionManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionManager’ defined in class path resource [spring-mvc.xml]: Cannot resolve reference to bean ‘ecacheManager’ while setting bean property ‘cacheManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ecacheManager’ defined in class path resource [spring-mvc.xml]: Initialization of bean failed; nested exception is org.springframework.beans.FatalBeanException: Error initializing bean [ecacheManager]; nested exception is org.apache.shiro.cache.CacheException: 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.

2. Solution:
<ehcache.version>2.4.8</ehcache.version>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
</dependency>

 

Similar Posts: