SpringMVC + Mybatis + Shiro + ehcache时缓存管理器报错。
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 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/spring-shiro-web.xml]: Cannot resolve reference to bean 'userRealm' while setting bean property
 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRealm' defined in class path resource [spring/spring-shiro-web.xml]: Cannot resolve reference to bean 'credentialsMatcher' while setting
 bean property 'credentialsMatcher'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'credentialsMatcher' defined in class path resource [spring/spring-shiro-web.xml]: Cannot resolve reference to bean
 'shiroCacheManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroCacheManager' defined in class path resource [spring/spring-shiro-web.xml]: Cannot resolve
 reference to bean 'ehCacheManager' while setting bean 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]: Invocation of init method failed; nested exception is 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:
最后红色是关键,说要确保缓存管理器仅仅能有一个!
在shiro1.3以后,要确保缓存管理器是单例的。
所以须要这样配
<!-- MyBatis使用ehcache缓存 start -->
<bean id="ehCacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache/shiroEhcache.xml" />
<property name="shared" value="true"></property> <!-- 这里是关键。!。没有必错 -->
</bean>
<!-- end MyBatis使用ehcache缓存 -->
<!-- 缓存管理器 使用Ehcache实现 -->
<bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
<property name="cacheManager" ref="ehCacheManager" />
</bean>
完整配置文档地址
http://download.csdn.net/detail/tragedyxd/9026633
SpringMVC + Mybatis + Shiro + ehcache时缓存管理器报错。的更多相关文章
- npm包管理器报错-npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/@XXX(over 30000ms)
		由于这两天买的新电脑在短期内频频蓝屏.卡机,不得不把自己其他的本本拿出来换上,但是程序员换电脑是真的痛苦,其他不说就说一个配环境 真的折腾哈 我是一名前端菜鸟,现在自己的本本上使用的是npm包管理工具 ... 
- ie11的DOM管理器报错
		IE11 Windows7下F12 DOC资源管理器不能用Exception in window.onload: Error: An error has ocurredJSPlugin.3005--- ... 
- SpringMVC+mybatis+maven+Ehcache缓存实现
		所谓缓存,就是将程序或系统经常要调用的对象存在内存中,以便其使用时可以快速调用,不必再去创建新的重复的实例.这样做可以减少系统开销,提高系统效率. 缓存主要可分为二大类: 一.通过文件缓存,顾名思义文 ... 
- shiro与Web项目整合-Spring+SpringMVC+Mybatis+Shiro(八)
		Jar包 
- SpringMVC+MyBatis+Shiro 配置文件详解
		1.web.xml文件的配置 <?xml version="1.0" encoding="UTF-8"?> <web-app version= ... 
- SpringMVC Mybatis Shiro RestTemplate的实现客户端无状态验证及访问控制【转】
		A.首先需要搭建SpringMVC+Shiro环境 a1.pom.xml配置 spring: <dependency> <groupId>org.springframework ... 
- SpringMVC+Mybatis+MySQL配置Redis缓存
		SpringMVC+Mybatis+MySQL配置Redis缓存 1.准备环境: SpringMVC:spring-framework-4.3.5.RELEASE-dist Mybatis:3.4.2 ... 
- 自定义缓存管理器 或者 Spring -- cache
		Spring Cache 缓存是实际工作中非常常用的一种提高性能的方法, 我们会在许多场景下来使用缓存. 本文通过一个简单的例子进行展开,通过对比我们原来的自定义缓存和 spring 的基于注释的 c ... 
- spring+springMVC+Mybatis 中使用@Transcational方式管理事务的配置方法
		springMVC 中,事务通常都在service层控制,当然controller层也可以用事务,只要配置配对,但通常不建议直接在controller层配事务,controller的作用是管理参数以及 ... 
随机推荐
- python基础语法(运算符及优先级)
			python基础语法(运算符及优先级) python语言支持的运算符类型 算数运算符 假设变量a为10,变量b为21 算数符 描述 实例 + 加-两个对象相加 a+b结果31 - 减-得到一个负数或者 ... 
- 一个很笨的方法,写脚本来实现自动调dmp,找有用的数据
			很久很久以前用到的方法, 方法挺笨的,但是算是比较实用吧. 全自动的调试dmp,最后只要结果. 谁用得着就给谁看吧. 这里需要两个脚本 1:启动脚本,是一个批处理文件,用来启动调试器,来加载dmp和调 ... 
- VS2017+QT5.12环境配置与动态链接库的生成
			最近需要重新编译一个DLL动态链接库,由于源码中包含了QT代码,所以现在需要配置VS+QT环境. 本人系统环境:Win10 64位 一.安装 Visual Studio 2017软件下载安装教程:ht ... 
- java_缓冲流(字节输入流)
			/** * java.iko.BufferedInputStream extends InputStream * BufferedInputStream:字节缓冲输入流 * 构造方法: * Buffe ... 
- 2019-8-2-WPF-依赖属性绑定不上调试方法
			title author date CreateTime categories WPF 依赖属性绑定不上调试方法 lindexi 2019-08-02 19:56:32 +0800 2019-8-2 ... 
- 图片上传的ImageIO工具类
			ImageIO类说明 最近的项目中遇到ImageIO,因此记录下这个类的用法 一.ImageIO: 这个类中的方法都是静态方法,可以用来进行简单的图片IO操作 1.读入的三种方法 public sta ... 
- <a>中的背景色变大
			想要调整文字链接背景颜色或图片的大小可以用padding属性: 但火狐和IE数值相同显示相同,但与360数值相同显示不同(上下宽度会变小.) 
- CSS3中2D/3D转换、过渡、动画
			转换.过渡.动画 2D 转换 1.translate() 方法 通过 translate() 方法,元素从其当前位置移动,根据给定的 left(x 坐标) 和 top(y 坐标) 位置参数: 实例 d ... 
- jeecms v9 vue环境搭建
			一.安装NODEJS运行环境 前往nodejs官网下载nodejs,https://nodejs.org/en/ ,建议下载最新稳定版的,下载后安装即可,下载选择类似如下 安装完毕之后,在cmd中输入 ... 
- 记录下sparkStream的做法(scala)
			一直用storm做实时流的开发,之前系统学过spark但是一直没做个模版出来用,国庆节有时间准备做个sparkStream的模板用来防止以后公司要用.(功能模拟华为日常需求,db入库hadoop环境) ... 
