[英]Hitting java.lang.IllegalStateException: null when call setAttribute() in HttpSession
美好的一天,
以下是我的Java代碼:
Map< String, Account > accountMap = result.getAccountsMap( );
if ( accountMap != null )
command.getSession( ).setAttribute( Constants.OA, accountMap );
從今天早上開始,它會IllegalStateException
觸發IllegalStateException
:
java.lang.IllegalStateException:在com.ibm.ws.session.http.HttpSessionImpl.setAttribute(HttpSessionImpl.java:248)處為null [在com.ibm.ws.session處為[com.ibm.ws.webcontainer.jar:na] .SessionData.putSessionValue(SessionData.java:293)〜[com.ibm.ws.webcontainer.jar:na]在com.ibm.ws.session.SessionData.setAttribute(SessionData.java:217)〜[com.ibm。 ws.webcontainer.jar:na]在com.ibm.ws.session.HttpSessionFacade.setAttribute(HttpSessionFacade.java:169)〜[com.ibm.ws.webcontainer.jar:na]
我曾嘗試在Google上進行搜索,但是這似乎是一個非常普遍的例外,而且我不知道應該如何/在何處繼續進行故障排除。
該應用程序在WAS 8.5.5上運行。
有人可以建議我嗎?
我想這屆會議是無效的。 您可以向isRequestedSessionIdValid()
添加支票嗎? 您是從command
對象中而不是直接從HttpServletRequest
拉出它,這意味着它很容易成為舊的,失效的。
沒錯,這是由於在無效會話上調用了該方法:
HttpServletRequest.getSession(false)那時也應該返回null。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.