shiro 无状态org.apache.shiro.subject.support.DisabledSessionException问题解决方案
最近使用shiro配JWT搭建无状态session时出现org.apache.shiro.subject.support.DisabledSessionException:Session creation has been disabled for the current subject 问题
经过排查发现原来是控制层中多写了httpsession,
在controller中,通过 request.getSession(_) 获取会话 session ,该session到底来源servletRequest 还是由shiro管理并管理创建的会话,主要由 安全管理器 SecurityManager 和 SessionManager 会话管理器决定。
request.getSession或者subject.getSession获取到session都会调用at org.apache.shiro.subject.support.DelegatingSubject.getSession()函数,这就导致了异常出现。
解决方案:把httpsession从控制层去掉就可以了。