Spring项目加入Shiro报错

在Spring项目中集成Shiro时遇到错误,报错信息指出CacheManager配置问题,涉及'authenticationCache', 'authorizationCache', 'shiro-activeSessionCache',原因在于未设置maxBytesLocalHeap或maxEntriesLocalHeap。解决办法是更新ehcache.xml配置。" 86446733,7376207,推荐系统原理与UserCF算法详解,"['机器学习', '推荐系统', '协同过滤']
摘要由CSDN通过智能技术生成

Spring项目加入Shiro报错

报错信息

Error initializing bean [cacheManager]; nested exception is org.apache.shiro.cache.CacheException: net.sf.ehcache.config.InvalidConfigurationException: There are 3 errors in your configuration:
* Cache ‘authenticationCache’ error: If your CacheManager has no maxBytesLocalHeap set, you need to either set maxEntriesLocalHeap or maxBytesLocalHeap at the Cache level
* Cache ‘authorizationCache’ error: If your CacheManager has no maxBytesLocalHeap set, you need to either set maxEntriesLocalHeap or maxBytesLocalHeap at the Cache level
* Cache ‘shiro-activeSessionCache’ error: If your CacheManager has no maxBytesLocalHeap set, you need to either set maxEntriesLocalHeap or maxBytesLocalHeap at the Cache level
*
初始化 bean [cacheManager] 时出错;嵌套异常是 org.apache.shiro.cache.CacheException: net.sf.ehcache.config.InvalidConfigurationException: 配置中有 3 个错误:
* Cache ‘authenticationCache’ 错误:如果您的 CacheManager 没有设置 maxBytesLocalHeap,则需要在缓存级别设置 maxEntriesLocalHeap 或 maxBytesLocalHeap
* Cache ‘authorizationCache’ 错误:如果你的 CacheManager 没有设置 maxBytesLocalHeap,你需要在缓存级别设置 maxEntriesLocalHeap 或 maxBytesLocalHeap
* Cache ‘shiro-activeSessionCache’ 错误:如果你的 CacheManager 没有设置 maxBytesLocalHeap,你需要在缓存级别设置 maxEntriesLocalHeap 或 maxBytesLocalHeap

解决办法

将原来的ehcache.xml替换为下边的代码


```xml
<?xml version="1.0" encoding="UTF-8"?>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小熊ai学习

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值