[tomcat启动报错]registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped

环境:一个tomcat ,一个工程配置了多数据源,在启动的时候报如下错误:

SEVERE: The web application [/qdp-resource-job] 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.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/qdp-resource-job] 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.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] 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.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-827239851] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Destroy-827239851] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-913636676] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Destroy-913636676] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-789799328] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Destroy-789799328] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2017 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-927599675] but has failed to stop it. This is very likely to create a memory leak.

解决方法:在多数据源配置的时候,只配置一个在启动的时候进行初始化,其他的不动,如下:

<!-- 第一数据源  -->
    <bean name="dataSourceResource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <property name="initialSize" value="${jdbc.initialSize}" />
        <property name="minIdle" value="${jdbc.minIdle}" />
        <property name="maxActive" value="${jdbc.maxActive}" />
        <property name="maxWait" value="${jdbc.maxWait}" />
        <property name="timeBetweenEvictionRunsMillis" value="${jdbc.timeBetweenEvictionRunsMillis}" />
        <property name="minEvictableIdleTimeMillis" value="${jdbc.minEvictableIdleTimeMillis}" />
        <property name="validationQuery" value="${jdbc.validationQuery}" />
        <property name="testWhileIdle" value="${jdbc.testWhileIdle}" />
        <property name="testOnBorrow" value="${jdbc.testOnBorrow}" />
        <property name="testOnReturn" value="${jdbc.testOnReturn}" />
        <property name="removeAbandoned" value="${jdbc.removeAbandoned}" />
        <property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" />
        <property name="filters" value="${jdbc.filters}" />
        <property name="logAbandoned" value="true" />
        <property name="proxyFilters">
            <list>
                <ref bean="log-filter"/>
            </list>
        </property>
    </bean>
    <!-- 第二数据源  -->
    <bean name="dataSourceCustomer" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
        <property name="url" value="${customer.url}" />
        <property name="username" value="${customer.username}" />
        <property name="password" value="${customer.password}" />
    </bean>

    <!-- 第三数据源  -->
    <bean name="dataSourceBuilding" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
        <property name="url" value="${building.url}" />
        <property name="username" value="${building.username}" />
        <property name="password" value="${building.password}" />
    </bean>

第二和第三数据源只保留最基础的url 、username、password 三个配置即可!

时间: 2024-10-10 16:44:58

[tomcat启动报错]registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped的相关文章

解决:The web application [] registered the 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.

问题描述 在将Spring Boot程序打包生成的war包部署到Tomcat后,启动Tomcat时总是报错,但是直接在IDEA中启动Application或者用"java -jar"方式运行jar包时都能正常运行.报错信息如下: To prevent a memory leak, the JDBC Driver has been forcibly unregistered. (为了防止内存泄漏,已强制注销JDBC驱动程序.) 开发环境 Spring Boot + MySql + Spr

registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped.

最近在用maven整合SSH做个人主页时候,在eclipse里面使用tomcat7插件发布项目是没有问题的,但当打包成war之后,使用tomcat7单独发布项目,就出现了以下的错误. 严重: Context [/wangxin] startup failed due to previous errors 八月 16, 2017 7:29:12 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc 严重: T

registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. (转)

最近项目中遇见一问题,在开发环境没有问题的代码,到了生产环境就会报如下错误: 严重: A web application registered the JBDC 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 unregiste

tomcat启动报错,找不到相应的 queue,从而引发内存泄漏

tomcat启动报错,无法创建 bean listenerStatusChangeDealHandler, no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost 从启动日志来看,有时候仅会看到内存泄漏,而没有与queue相关的日志,非常easy走错方向. 依照 http://blog.csdn.net/wangjunjun2008/article/details/23375501 的方法能够看到具体日志,从而确定报错原因 tomcat

tomcat启动报错,找不到对应的 queue,从而引发内存泄漏

tomcat启动报错,无法创建 bean listenerStatusChangeDealHandler, no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost 从启动日志来看,有时候仅会看到内存泄漏,而没有与queue相关的日志,很容易走错方向. 按照 http://blog.csdn.net/wangjunjun2008/article/details/23375501 的方法可以看到详细日志,从而确定报错原因 tomcat启动报

Tomcat启动报错[org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed

Tomcat启动报错: [org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/E:/SoftwareDevelopment/Software/Eclipse4.3/eclipse-jee-kepler-SR1-win32-x86_64/Workspace/.metadata/.plugins/org.ec

Tomcat启动报错java.net.AbstractPlainSocketImpl(java/net/AbstractPlainSocketImpl.java:178:-1)Struts在网络复杂情况下启动报错解决办法

SSH项目 在网络复杂的情况(具体规律未知)下,Tomcat启动时,报如下错误: [ERROR] 2014-08-12 14:52:58,484 [org.apache.struts2.dispatcher.Dispatcher :27] - Dispatcher initialization failedUnable to load configuration. - Class: java.net.AbstractPlainSocketImplFile: AbstractPlainSocket

Tomcat启动报错:严重: StandardServer.await: create[8005] java.net.BindException: Cannot assign requested address

org.apache.catalina.core.StandardServer await        SEVERE: StandardServer.await: create[8005]:        java.net.BindException: Cannot assign requested address java.net.BindException: Cannot assign requested address        at java.net.PlainSocketImpl

Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误——SHH框架

SHH框架工程,Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误 1.查看配置文件web.xml中是否配置.org.springframework.web.context.ContextLoaderListener在web.xml配置文件中已经配置 2.查看工程是否添加此jar包,org.springframework.web.context.ContextLoaderListener的jar包为spring