环境:一个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 , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-] but has failed to stop it. This is very likely to create a memory leak.
Aug , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Destroy-] but has failed to stop it. This is very likely to create a memory leak.
Aug , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-] but has failed to stop it. This is very likely to create a memory leak.
Aug , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Destroy-] but has failed to stop it. This is very likely to create a memory leak.
Aug , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-] but has failed to stop it. This is very likely to create a memory leak.
Aug , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Destroy-] but has failed to stop it. This is very likely to create a memory leak.
Aug , :: PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/qdp-resource-job] appears to have started a thread named [Druid-ConnectionPool-Create-] 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 三个配置即可!

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

  1. 解决: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" ...

  2. 严重: 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

    idea项目启动报如下错误, 网上的方法都试了都没用, 一直没解决, 干掉项目, 重新从svn检出就好了...坑 啊 Root WebApplicationContext: initializatio ...

  3. 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单独发布项目,就出现了以下的错误. 严重: Cont ...

  4. 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.jd ...

  5. 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.

    最近使用了最新版的tomcat9,使用jdbc链接mysql数据库.关闭tomcat过程中出现警告 13-Sep-2017 22:22:54.369 WARNING [main] org.apache ...

  6. The web application [ ] registered the JDBC driver [net.sourceforge.jtds.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver

    出现以下错误时,我找了很多方法,都未解决,网上有很多,最后我实在无奈,怀疑会不会是Tomcat的原因,更换了一个版本之后就好了.The web application [ ] registered t ...

  7. 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.

    问题是tomcat的版本问题,tomcat新检测机制导致的这个问题,换版本可以解决问题,但不建议这么做,租用服务器不是你说换就换的.其实问题根源是BasicDataSource,BasicDataSo ...

  8. Tomcat启动报错org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file

    错误: 今天SVN导入新项目后启动项目时控制台报错,之后在网上搜了很多方法.下面列了一些大佬的解决方案: 1. 检查日志配置文件-logging.properties:https://www.cnbl ...

  9. The web application [/codeMarket] registered the JBDC driver[.........] but failed to unregister it when the web application was stopped. To prevent

    如果你报错了上面的这个严重,那么你的tomcat版本一定是在6.0.25之上的 原因:tomcat 6.025以后在sever.xml中引入了内存泄露侦测,对于垃圾回收不能处理的对像,它就会做日志. ...

随机推荐

  1. Django 自定义模板语法

    from django import template from django.utils.safestring import mark_safe register = template.Librar ...

  2. Sublime Text3 最新版本V3.1.1 build3117注册码,亲测可以完美激活~

    Sublime Text 3 最新注册码 官网下载的最新版本V3.1.1 build3117,亲测以下注册码可以正常激活 ----- BEGIN LICENSE ----- sgbteam Singl ...

  3. [c++] opencv加载png

    1.cvloadimage载入png文件时,默认的第2个参数是1,即CV_LOAD_IMAGE_COLOR,生成的iplimage对象的channel数是3,而不是4,丢失了第4通道.需要改为cvlo ...

  4. BZOJ4422 : [Cerc2015]Cow Confinement

    从右往左扫描线,用线段树维护扫描线上每一个点能达到的花的数量,并支持最近篱笆的查询. 对于一朵花,找到它上方最近的篱笆,那么它对这中间的每头牛的贡献都是$1$. 当扫到一个篱笆的右边界时,这中间的答案 ...

  5. C++学习笔记54:关联容器,函数对象

    关联容器的特点 1.每个关联容器都有一个键(key) 2.可以根据键高效查找元素 集合set 集合用来存储一组无重复的元素,由于集合的元素本身是有序的,可以高效地查找元素,也可以方便地指定大小范围的元 ...

  6. 查看过多占用cpu的是哪部分代码?

    https://www.linuxidc.com/Linux/2016-04/130528.htm (1)top命令可查看是哪个项目占用的cpu内存较大,找到该项目对应的PID (2)top -H - ...

  7. django进阶篇

    原文连接:http://www.cnblogs.com/wupeiqi/articles/5246483.html Model 到目前为止,当我们的程序涉及到数据库相关操作时,我们一般都会这么搞: 创 ...

  8. C盘清理(安装Visual Studio 或者Office后)

    安装过Office,可能会存在一个C:\\MSOCache的隐藏目录,如果在D盘安装,这个文件夹可能会在D盘根目录下.该目录为Offices安装组件的目录,理解为安装包即可,如果日后不再修改OFFIC ...

  9. sql基本查询语句

    查询语句的五中字句:where(条件查询),having(筛选),group by(分组),order by(排序),Limit(限制结果数) 一 单表查询 1.查询指定列:select 列名 fro ...

  10. ES6_函数方法

    //2017/7/15 //Javascript 中的方法:在一个对象中绑定函数,称为这个对象的方法. */ var boy={ name:'xiaoming', birth:2007, age:fu ...