tomcat默认reload引起宕机

项目使用文件来保存修改,为了方便直接把文件放在src目录下;部署后发现过了一阵tomcat就会宕机;

日志为:

Oct 18, 2013 5:20:11 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Oct 18, 2013 5:20:11 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/a7list] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@13c4a657]) and a value of type [com.caucho.services.server.ServiceContext] (value [com.caucho.services.server.ServiceContext@5384a3e4]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

...-----

 tomcat 6.025之后引入了一种内存泄露的检查机制,会把不能垃圾收集的对像做日志。

当您重新部署您的应用程序时,Tomcat 将创建新的类加载器。旧类加载器必须是垃圾回收,否则你会 permgen 内存泄漏。

分析原因是由于运行项目的classes目录文件变更引起tomcat reload,同时reload时没有释放资源引起的宕机。

修改方式:

1、部署时修改tomcat 的server.xml文件,让项目变更时不reload。

修改文件:conf\server.xml

修改位置:

2、将变更文件放到项目代码外面。

采用的方式是两种都使用了~

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0