• Shiro在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)

    出现上面的问题,是我在修改springMVC整体的URL后缀(原来是MVC)为html的时候出现,我忘记修改shiroFilter的入口mapping的配置为.html造成的错误。

    <!-- Shiro Security filter -->
    <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>*.jsp</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>shiroFilter</filter-name>
    <url-pattern>*.mvc</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>

    </filter-mapping>



    修改为

    <filter-mapping>
    <filter-name>shiroFilter</filter-name>
    <url-pattern>*.html</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    </filter-mapping>


  • 相关阅读:
    docker架构的详解
    docker的核心原理-cgroup
    网络运维面试题
    100道linux运维笔试题
    运维岗位面试题集合
    python——筛子游戏
    同道前辈
    delphi中使用SocketStream读写数据的技巧
    百度地图API
    HTML中小meta的大作用
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3098178.html
Copyright © 2020-2023  润新知