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)
...
出错原因:
引用
Tomcat invokes the filter chain only on REQUEST dispatcher. It's a standard servlet thing, but I'm not sure if Jetty implements dispatchers at all or they just have a different default
(Tomcat调用filter过滤器是默认只拦截 REQUEST请求,这其实是符合servlet标准的,但jetty调用filter过滤器时会拦截所有请求)
例如我们的common.jsp被别的页面用<jsp:include>标签包含时,jetty下filter依然起作用,但tomcat可不理会,这样common.jsp里如果有shiro的jsp标签,这个标签会调用securityManager获取当前的用户对象,但由于shirofilter过滤器没起作用,会导致标签找不到上下文