java 清除 tomcat 7 中 Web 应用程序的所有会话

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11772197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 06:18:27  来源:igfitidea点击:

Clear all sessions for web application in tomcat 7

javasessiontomcat7

提问by Gyan

I'm trying to update a couple of JAR files after my web application starts and doing a restart for the changes to take effect.(requirement) The problem is , the session information is being persisted by tomcat. Yes, I do have a "sessionEventListener" listener in my application, but that shouldn't be a problem IMHO.

我正在尝试在我的 Web 应用程序启动并重新启动后更新几个 JAR 文件以使更改生效。(要求)问题是,tomcat 正在保留会话信息。是的,我的应用程序中确实有一个“sessionEventListener”侦听器,但恕我直言,这应该不是问题。

I want everything to start afresh from tomcat ( running standalone) , be it sessions, cache, or any information about the web application given to tomcat, except for the WAR file of course.

我希望一切都从 tomcat(独立运行)重新开始,无论是会话、缓存还是有关提供给 tomcat 的 Web 应用程序的任何信息,当然,WAR 文件除外。

Any help would be appreciated.

任何帮助,将不胜感激。

回答by Kennet

During development (in Eclipse) I usually use 'Clean Tomcat Work Directory' option found when right clicking on Servers view. That will wipe all session related data.

在开发期间(在 Eclipse 中),我通常使用右键单击服务器视图时找到的“清洁 Tomcat 工作目录”选项。这将擦除所有与会话相关的数据。

回答by Nikhil

In your tomcat 7 context.xml you can add/uncomment this line to clear all sessions on tomcat restart.

在您的 tomcat 7 context.xml 中,您可以添加/取消注释此行以清除 tomcat 重启时的所有会话。

<Manager pathname="" />