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会重新加载