Environment: A tomcat, a project configured with multiple data sources, the following error is reported at startup:
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 have been forcibly unregistered. the3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearreferencesjdbcsevere: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 have been forcibly unregistered. 3:23:27 PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web Application [ /qdp-resource-job] appears to had started a thread named [Abandoned connection cleanup thread] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-create-827239851] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-destroy-827239851] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-create-913636676] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-destroy-913636676] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-create-789799328] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-destroy-789799328] but had failed to stop it. This was very likely to create a memory leak. the -, . 3: at: -PM org.apache.catalina.loader.WebappClassLoader clearreferencesthreadssevere:the Web application [/qdp-resource-job] appears to has started a thread named [druid-connectionpool-create-927599675] but had failed to stop it. This was very likely to create a memory leak.
WORKAROUND: When configuring multiple data sources, configure only one to initialize at startup, and the other to be fixed, as follows:
<!--First Data source - <Beanname= "Datasourceresource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> < Propertyname= "url"value= "${jdbc.url}" /> < Propertyname= "username"value= "${jdbc.username}" /> < Propertyname= "Password"value= "${jdbc.password}" /> < Propertyname= "InitialSize"value= "${jdbc.initialsize}" /> < Propertyname= "Minidle"value= "${jdbc.minidle}" /> < Propertyname= "Maxactive"value= "${jdbc.maxactive}" /> < Propertyname= "Maxwait"value= "${jdbc.maxwait}" /> < Propertyname= "Timebetweenevictionrunsmillis"value= "${jdbc.timebetweenevictionrunsmillis}" /> < Propertyname= "Minevictableidletimemillis"value= "${jdbc.minevictableidletimemillis}" /> < Propertyname= "Validationquery"value= "${jdbc.validationquery}" /> < Propertyname= "Testwhileidle"value= "${jdbc.testwhileidle}" /> < Propertyname= "Testonborrow"value= "${jdbc.testonborrow}" /> < Propertyname= "Testonreturn"value= "${jdbc.testonreturn}" /> < Propertyname= "removeabandoned"value= "${jdbc.removeabandoned}" /> < Propertyname= "Removeabandonedtimeout"value= "${jdbc.removeabandonedtimeout}" /> < Propertyname= "Filters"value= "${jdbc.filters}" /> < Propertyname= "logabandoned"value= "true" /> < Propertyname= "Proxyfilters"> <List> <refBean= "Log-filter"/> </List> </ Property> </Bean> <!--Second Data source - <Beanname= "Datasourcecustomer"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> < Propertyname= "url"value= "${customer.url}" /> < Propertyname= "username"value= "${customer.username}" /> < Propertyname= "Password"value= "${customer.password}" /> </Bean> <!--Third Data source - <Beanname= "Datasourcebuilding"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> < Propertyname= "url"value= "${building.url}" /> < Propertyname= "username"value= "${building.username}" /> < Propertyname= "Password"value= "${building.password}" /> </Bean>
The second and third data sources retain only the most basic URL, username, password three configurations!
[Tomcat boot error]registered the JDBC driver [Com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web appl Ication was stopped