org.springframework.beans.MethodInvocationException: Property 'cacheManager' threw exception; nested...

 shiro cache manage配置报错:

org.springframework.beans.MethodInvocationException: Property 'cacheManager' threw exception; nested exception is org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Caches cannot be added by name when default cache config is not specified in the config. Please add a default cache config in the configuration.
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1471)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1216)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:232)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

需要在ehcahe.xml在加入默认配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <ehcache updateCheck="false"  name="shirocache">
 3     <diskStore path="java.io.tmpdir"/>
 4     <defaultCache    
 5         maxElementsInMemory="10000"    
 6         maxElementsOnDisk="0"    
 7         eternal="true"    
 8         overflowToDisk="true"    
 9         diskPersistent="false"    
10         timeToIdleSeconds="0"    
11         timeToLiveSeconds="0"    
12         diskSpoolBufferSizeMB="50"    
13         diskExpiryThreadIntervalSeconds="120"    
14         memoryStoreEvictionPolicy="LFU"    
15     />      
16     <!-- 登录记录缓存 锁定10分钟 -->
17     <cache name="passwordRetryCache"
18            maxEntriesLocalHeap="2000"
19            eternal="false"
20            timeToIdleSeconds="3600"
21            timeToLiveSeconds="0"
22            overflowToDisk="false"
23            statistics="true">
24     </cache>
25     <cache name="authorizationCache"
26            maxEntriesLocalHeap="2000"
27            eternal="false"
28            timeToIdleSeconds="3600"
29            timeToLiveSeconds="0"
30            overflowToDisk="false"
31            statistics="true">
32     </cache>
33     <cache name="authenticationCache"
34            maxEntriesLocalHeap="2000"
35            eternal="false"
36            timeToIdleSeconds="3600"
37            timeToLiveSeconds="0"
38            overflowToDisk="false"
39            statistics="true">
40     </cache>
41     <cache name="shiro-activeSessionCache"
42            maxEntriesLocalHeap="2000"
43            eternal="false"
44            timeToIdleSeconds="3600"
45            timeToLiveSeconds="0"
46            overflowToDisk="false"
47            statistics="true">
48     </cache>
49     <cache name="shiro_cache"
50            maxElementsInMemory="2000"
51            maxEntriesLocalHeap="2000"
52            eternal="false"
53            timeToIdleSeconds="0"
54            timeToLiveSeconds="0"
55            maxElementsOnDisk="0"
56            overflowToDisk="true"
57            memoryStoreEvictionPolicy="FIFO"
58            statistics="true">
59     </cache>
60 </ehcache>

 

转载于:https://www.cnblogs.com/XinHuai/p/6861106.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值