且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

session.invalidate()IllegalStateException

更新时间:2023-11-28 11:28:40

您可以使用HttpSessionListener了解哪里和何时会话超时或无效之前,您将自动呼叫无效。


I'm trying to invalidate a session. When I call:

session.invalidate()

it throws

java.lang.IllegalStateException: getLastAccessedTime: Session already invalidated

Any idea why? I can see the session and it's values just before the invalidate line.

You can use an HttpSessionListener to understand where and when the Session is timing-out or getting invalidated before you call the invalidate yourself.