tomcat 环境是tomcat 8.5,tomcat重启完之后,session 不清除,我参照网上的文章,修改了tomcat ,配置文件content.xml。在文件的最后添加了让持久化失效的内容。
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
修改完之后的完整的content.xml文件如下
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
.................................................................
.........................................................................
--><Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
</Context>
重启服务之后,session会重新加载
本文介绍了一种在Tomcat8.5环境下通过修改配置文件content.xml来实现重启服务后Session不保留的方法。主要通过设置PersistentManager的saveOnRestart属性为false,并使用FileStore类来达到目的。
3802

被折叠的 条评论
为什么被折叠?



