zoukankan      html  css  js  c++  java
  • shiro错误No SecurityManager accessible to the calling code

    Shire在Web.xml中shiroFilter的Mapping配置错误

    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.

    at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)

    at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:627)

    at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)

    at com.feinno.module.security.web.JsonLoginController.login(JsonLoginController.java:41)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    出错的原因在于没有配置shiroFilter,应该在web.xml加入代码:

    <!-- shiro -->
    <filter> 
        <filter-name>shiroFilter</filter-name> 
        <filter-class>
            org.springframework.web.filter.DelegatingFilterProxy
        </filter-class> 
    </filter> 
    <filter-mapping> 
        <filter-name>shiroFilter</filter-name> 
        <url-pattern>/*</url-pattern> 
    </filter-mapping>
  • 相关阅读:
    nginx upstream负载均衡配置
    什么是任务编排、服务发现、服务间依赖怎么处理?
    python celery 错误重试配置
    rust cargo 从入门到放弃
    python 日志模块再熟悉
    python signal笔记
    Fabric使用笔记
    webpack 笔记
    sphinx-python文档化
    Docker笔记
  • 原文地址:https://www.cnblogs.com/beyondfengyu/p/3466729.html
Copyright © 2011-2022 走看看