org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling c
2013-07-07 23:59
1011 查看
关于shiro错误的分析
错误提示:
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code,either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.
错误原因:
在web.xml中配置shiro filter的时候,shiro filter放置位置放到了struts2 filter后面
原因分析:
如果使用struts2,那么在struts2加载静态资源的时候,需要将静态资源SecurityUtils也加载进去,如果将shiro filter放置位置放到了struts2 filter后面,那么必将导致无法加载到struts2中去,而后使用SecurityUtils.getSubject();的时候,导致出错,
解决办法:
shiro的filter应该放在struts2的 filter的上面
还可以在使用之前使用这种方式:即在SecurityUtils.getSubject();之前加入如下代码
错误提示:
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code,either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.
错误原因:
在web.xml中配置shiro filter的时候,shiro filter放置位置放到了struts2 filter后面
原因分析:
如果使用struts2,那么在struts2加载静态资源的时候,需要将静态资源SecurityUtils也加载进去,如果将shiro filter放置位置放到了struts2 filter后面,那么必将导致无法加载到struts2中去,而后使用SecurityUtils.getSubject();的时候,导致出错,
解决办法:
shiro的filter应该放在struts2的 filter的上面
还可以在使用之前使用这种方式:即在SecurityUtils.getSubject();之前加入如下代码
Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini"); // 创建SecurityManager (根据配置创建SecurityManager实例) SecurityManager security = factory.getInstance(); SecurityUtils.setSecurityManager(security);这个想必不用解释了吧
相关文章推荐
- org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling c
- org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling c
- fastjson No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.uti
- shiro之org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible
- junit集成maven。 No SecurityManager accessible to the calling code, either bound to the org.apache.shir
- Shiro 集成 No SecurityManager accessible to the calling code....
- junit+springMVC单元测试异常:org.apache.shiro.UnavailableSecurityManagerException
- shiro报错:No SecurityManager accessible to the calling code
- No SecurityManager accessible to the calling code
- Jmeter返回org.apache.http.NoHttpResponseException: The target server failed to respond解决办法
- jmeter运行报错:org.apache.http.NoHttpResponseException: The target server failed to respond
- shiro学习随笔【四】session过期报 org.apache.shiro.session.UnknownSessionException: There is no session with id
- shiro学习随笔【四】session过期报 org.apache.shiro.session.UnknownSessionException: There is no session with id
- org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the
- ssm+shiro 在点击退出登录执行logout后报错:org.apache.shiro.session.UnknownSessionException: There is no session w
- shiro学习随笔【四】session过期报 org.apache.shiro.session.UnknownSessionException: There is no session with id
- org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the
- 解决org.apache.shiro.session.UnknownSessionException: There is no session with id的问题(转)
- org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the
- shiro学习随笔【四】session过期报 org.apache.shiro.session.UnknownSessionException: There is no session with id