gpt4 book ai didi

java - Mysql AbandonedConnectionCleanupThread 错误

转载 作者:行者123 更新时间:2023-11-28 22:47:23 26 4
gpt4 key购买 nike

我想在 tomcat 外部部署一个 spring boot web 应用程序但是错误,我无法修复它。请帮助我,非常感谢。

application.properties

server.port=8080
spring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect
#spring.jpa.properties.hibernate.id.new_generator_mappings = false
spring.jpa.properties.hibernate.format_sql = true

日志

java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(Unknown Source)
com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:70)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
14-Jan-2019 16:25:53.860 INFO [http-nio-8080-exec-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Server\Tomcat-8.5\webapps\springboot-0.0.1-SNAPSHOT.war has finished in 12,765 ms
14-Jan-2019 16:25:54.713 INFO [Abandoned connection cleanup thread] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:986)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

最佳答案

把你的配置改成mysql驱动提供的,如果你用war编译驱动,当你部署到tomcat上时,很多线程无法删除。

我在 gradle 项目中遇到了同样的问题,我的配置是:

runtime 'mysql:mysql-connector-java:8.0.13'

我把它改成

provided 'mysql:mysql-connector-java:8.0.13'

解决了我的问题

关于java - Mysql AbandonedConnectionCleanupThread 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54178788/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com