异常处理-No SecurityManager accessible to the calling code

十二月 02, 2016 3:38:35 下午 org.apache.catalina.core.ApplicationDispatcher invoke

严重: Servlet.service() for servlet springServlet threw exception

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.(Subject.java:627)

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

      at com.hylandtec.ibank.common.UserSessionInterceptor.preHandle(UserSessionInterceptor.java:30)

      at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:130)

      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)

      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)

      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)

      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)

      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:488)

      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)

      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)

      at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)

      at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:337)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:202)

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      at java.lang.Thread.run(Thread.java:745)

十二月 02, 2016 3:38:35 下午 org.apache.catalina.core.StandardHostValve custom

严重: Exception Processing ErrorPage[errorCode=404, location=/error/404.html]

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is 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.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)

      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)

      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:488)

      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)

      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)

      at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)

      at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:337)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:202)

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      at java.lang.Thread.run(Thread.java:745)

Caused by: 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.(Subject.java:627)

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

      at com.hylandtec.ibank.common.UserSessionInterceptor.preHandle(UserSessionInterceptor.java:30)

      at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:130)

      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)

      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)

      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)

      ... 24 more

出现问题原因有:

1,没有配置 

            

            

            

            

2,web.xml  斜体部分不能少

 

    shiroFilter

    org.springframework.web.filter.DelegatingFilterProxy

   

      targetFilterLifecycle

      true

   

 

 

    me>shiroFilter

    /*

    REQUEST

    FORWARD

    ERROR

    INCLUDE

 

 

3,关于shiro放置的web.xml的顺序

web.xml中有其它filter 引用到 shiroFilter 里的属性或者其它。

这些filter 要放在 shiroFilter的后面。

你可能感兴趣的:(java)