H5W3
当前位置:H5W3 > 其他技术问题 > 正文

Tomcat 停止的时候出现的警告问题。

这是我截取的输出的警告日志:

Connected to server
[2016-09-23 09:26:22,319] Artifact xk_mvn_1:war exploded: Artifact is being deployed, please wait...
23-Sep-2016 21:26:24.478 INFO [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2016-09-23 09:26:26,148] Artifact xk_mvn_1:war exploded: Artifact is deployed successfully
[2016-09-23 09:26:26,148] Artifact xk_mvn_1:war exploded: Deploy took 3,829 milliseconds
23-Sep-2016 21:26:26.436 INFO [http-nio-8888-exec-1] [wqh.controller.MainController] .invoke0 wqh.controller:index_f
Fri Sep 23 21:26:26 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Fri Sep 23 21:26:26 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
23-Sep-2016 21:26:26.827 INFO [http-nio-8888-exec-2] [wqh.controller.MainController] .invoke0 wqh.controller:index_f
23-Sep-2016 21:26:27.085 INFO [http-nio-8888-exec-3] [wqh.controller.MainController] .invoke0 wqh.controller:index_f
"C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\catalina.bat" stop
Using CATALINA_BASE:   "C:\Users\devts\.IntelliJIdea15\system\tomcat\Unnamed_xk_mvn_1"
Using CATALINA_HOME:   "C:\Program Files\Apache Software Foundation\Tomcat 9.0"
Using CATALINA_TMPDIR: "C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.8.0_92"
Using CLASSPATH:       "C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\tomcat-juli.jar"
23-Sep-2016 21:26:31.340 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
23-Sep-2016 21:26:31.340 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8888"]
23-Sep-2016 21:26:31.392 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8008"]
23-Sep-2016 21:26:31.443 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
23-Sep-2016 21:26:31.461 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
23-Sep-2016 21:26:31.461 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] 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)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
23-Sep-2016 21:26:31.462 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Timer-0] 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)
 java.lang.Object.wait(Object.java:502)
 java.util.TimerThread.mainLoop(Timer.java:526)
 java.util.TimerThread.run(Timer.java:505)
23-Sep-2016 21:26:31.475 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8888"]
23-Sep-2016 21:26:31.477 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8008"]
23-Sep-2016 21:26:31.478 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8888"]
23-Sep-2016 21:26:31.479 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8008"]

运行环境:

IDEA15.06+JDK1.8+Tomcat9

疑问:这个警告代表什么?Timer-0是哪里来的?
`23-Sep-2016 21:26:31.462 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
`

回答:

其实是在使用数据连接池的时候注册了数据驱动,但是关闭tomcat的时候没有反注册,手动把它反注册就好了。

      try {
            DriverManager.deregisterDriver(DriverManager.getDrivers().nextElement());
        }catch (Exception e){
            e.printStackTrace();
        }

回答:

出现了和你 一样的情况,请问怎么解决了吗?

回答:

JDBC连接没有正确关闭,你看是不是代码哪里获取数据库连接没有close或者close没调用到。

回答:

你可以试试降低一下版本,用JDK1.7+Tomcat7,感觉用的版本好高

本文地址:H5W3 » Tomcat 停止的时候出现的警告问题。

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址