[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 三個配置即可!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. 啟動錯誤筆記:DruidDriver] but failed to unregister it when the web application was stopped,To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 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. 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. registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. (轉) 嚴重: The web application [] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDB 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. 解決: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. 注冊了JDBC驅動程序 [com.alibaba.druid.proxy.DruidDriver],但在Web應用程序停止時無法注銷它。 為防止內存泄漏,JDBC驅動程序已被強制取消注冊。 嚴重: The web application [/] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregis
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM