解决The web application [blogs] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver].. 问题

        首先,我们来看看报错信息,如下!看到这个错误一脸懵逼,然后百度翻译一下:web应用程序[blogs]注册了jdbc驱动程序[com.alibaba.druid.proxy.druid driver],但在web应用程序停止时未能注销。为了防止内存泄漏,JDBC驱动程序被强制注销。

       百度了一大堆,说什么把连接数据库的jar包,拷贝到tomcat/lib文件夹下什么的,都不靠谱,只有自己填坑了,记录一下!

1、看报错信息:

警告: The web application [blogs] 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.
七月 18, 2019 6:16:19 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [blogs] 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.
七月 18, 2019 6:16:19 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [blogs] 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:64)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 java.lang.Thread.run(Thread.java:748)

七月 18, 2019 6:16:21 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
警告: The web application [blogs] 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.
七月 18, 2019 7:06:03 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [blogs] 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.
七月 18, 2019 7:06:03 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [blogs] 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:64)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 java.lang.Thread.run(Thread.java:748)

七月 18, 2019 7:06:05 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
七月 18, 2019 7:06:05 下午 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.
七月 18, 2019 7:06:05 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
七月 18, 2019 7:06:05 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization started
[com.alibaba.druid.pool.DruidDataSource]removeAbandoned is true, not use in productiion.
[com.alibaba.druid.pool.DruidDataSource]{dataSource-1} inited
七月 18, 2019 7:06:07 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext initialized in 1850 ms
七月 18, 2019 7:06:07 下午 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:1384)
    at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1034)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:90)
    at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:63)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)


 2、报错原因:

       字面意思:为了防止内存泄漏,JDBC驱动程序已经被强制注销

3、解决办法:

     1)、找到Tomcat安装目录中下的server.xml文件 :D:\Tomcat8.5\conf\server.xml

     2)、Ctrl + F  ---> 输入:Listener (大概在:21-30行的, 标签全部注释掉!)

解决The web application [blogs] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver].. 问题_第1张图片

    3)、继续在server.xml文件中查找:reloadable (一般就在最后)

          将   reloadable="true" :改为 false

解决The web application [blogs] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver].. 问题_第2张图片

 

最后,该问题就得到解决了!

 

你可能感兴趣的:(Spring,Spring,MVC,MyBatis)