亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

使用自定義shiro Session管理 用戶退出時出現StoppedSessionException 異常

//用戶退出
SecurityUtils.getSubject().logout();
/**
?*?自定義session?管理
?*?解決多次請求redis?session?問題
?*?@author?Administrator
?*
?*/
public?class?CustomSessionManager?extends?DefaultWebSessionManager{
@Override
protected?Session?retrieveSession(SessionKey?sessionKey)?throws?UnknownSessionException?{
System.out.println(">>>>>>進入>>>>session>>>>>start");
Serializable?sessionId?=?getSessionId(sessionKey);
ServletRequest?request=null;
if(sessionId?==null?)?{
System.out.println(">>>>>>sessionId?is?null");
System.out.println(">>>>>>進入>>>>session>>>>end");
return?null;
}
if(sessionKey?instanceof?WebSessionKey)?{
request?=?((WebSessionKey)?sessionKey).getServletRequest();
}
//先從request中獲取session?如果沒有
if(request?!=?null?&&?sessionId?!=?null)?{
Session?session?=?(Session)?request.getAttribute(sessionId.toString());
//返回不為null的session
if(session?!=?null?)?{
System.out.println(">>>>>>進入>>>>session>>>>end1");
return?session;
}
}
//如果request?中沒有?session?則從redis中獲取并保存到request
Session?session?=?super.retrieveSession(sessionKey);
if(request?!=?null?&&?sessionId?!=?null?)?{
request.setAttribute(sessionId.toString(),?session);
}
System.out.println(">>>>>>進入>>>>session>>>>end2");
return?session;
}
}

異常信息↓
六月?21,?2018?3:56:30?下午?org.apache.catalina.core.StandardWrapperValve?invoke
嚴重:?Servlet.service()?for?servlet?[DispatcherServlet]?in?context?with?path?[/shiro-spring]?threw?exception?[Request?processing?failed;?nested?exception?is?java.lang.IllegalStateException:?org.apache.shiro.session.StoppedSessionException:?Session?with?id?[77105aa0-5cf8-411a-9a4f-2f257674eb8e]?has?been?explicitly?stopped.??No?further?interaction?under?this?session?is?allowed.]?with?root?cause
org.apache.shiro.session.StoppedSessionException:?Session?with?id?[77105aa0-5cf8-411a-9a4f-2f257674eb8e]?has?been?explicitly?stopped.??No?further?interaction?under?this?session?is?allowed.
at?org.apache.shiro.session.mgt.SimpleSession.validate(SimpleSession.java:270)
at?org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doValidate(AbstractValidatingSessionManager.java:186)
at?org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validate(AbstractValidatingSessionManager.java:143)
at?org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:120)
at?org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:148)
at?org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:152)
at?org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:249)

有大佬測試過怎么解決嗎????!?。?!

https://img1.sycdn.imooc.com//5b2b5d13000159bd18860873.jpg


正在回答

1 回答

兄弟,解決了嗎?

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

使用自定義shiro Session管理 用戶退出時出現StoppedSessionException 異常

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號