tomcat相关问题

#tomcat相关问题

tomcat重启session不消失

问题:

项目发布到服务器,服务器本身在运行,用户处于登录状态,这时我停到tomcat进行发布,发布之后,用户的session没有被销毁,用户依然处于登录状态

原因:

tomcat6之后默认session持久化开启
参考文档https://blog.csdn.net/w420372197/article/details/7310293

解决:

修改”tomcat根目录/conf/context.xml”文件

1
2
3
4
5
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!-- 翻译:取消注释此项可在Tomcat重新启动时禁用会话持久性 -->
<!--
<Manager pathname="" />
-->

修改为

1
2
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<Manager pathname="" />

other:

项目发布后js中文乱码

问题:

项目发布到服务器中其他一切正常,js中中文乱码

原因:

解决:

修改”tomcat根目录/config/server.xml”

1
2
3
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

修改为

1
2
3
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="utf-8"/>

other:

idea中tomcat配置server –> VM options项中添加”-Dfile.encoding=utf-8”,这样idea中就也可以了

坚持原创技术分享,您的支持将鼓励我继续创作!