环境是在Linux部署项目,启动tomcat运行的时候没有问题,但是关闭tomcat的时候看到日志里面有内存泄漏的警告,因为我的是定时修改,有一个JDBC的错误大概就是关闭tomcat的时候这个操作没有回滚回来。而内存泄漏的问题大概就是tomcat关闭之前没有先关闭quartz的线程导致内存泄漏,这个情况该怎么解决???
23-Oct-2019 14:37:31.067 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance. 23-Oct-2019 14:37:31.068 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8765"] 23-Oct-2019 14:37:31.120 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-9009"] 23-Oct-2019 14:37:31.171 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina] 23-Oct-2019 14:37:31.554 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 23-Oct-2019 14:37:31.555 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 23-Oct-2019 14:37:31.557 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [OracleTimeoutPollingThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Thread.sleep(Native Method) oracle.jdbc.driver.OracleTimeoutPollingThread.run(OracleTimeoutPollingThread.java:150) 23-Oct-2019 14:37:31.559 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [DefaultQuartzScheduler_Worker-7] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 23-Oct-2019 14:37:31.560 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [DefaultQuartzScheduler_Worker-9] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 23-Oct-2019 14:37:31.562 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [DefaultQuartzScheduler_Worker-10] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543)
项目:JFinal
信息提示 tomcat 已经强制关闭了它们,需要确定一下 tomcat 是否真的 shutdown 成功,如果成功不会造成资源泄漏,因为 JVM 退出时会回收所有资源
此外,信息中提示是 WARNING, 措辞是 "likely",也就是 tomcat 并不是完全确定
建议使用 jfinal undertow,不存在这里问题:
https://www.jfinal.com/doc/1-2
jfinal undertow 支持开发、打包、部署一体化,性能更高,不必再折腾 tomcat 下载、安装、配置这种事情