把datesource的bean的class由

org.apache.commons.dbcp2.BasicDataSource

改成

org.apache.tomcat.dbcp.dbcp.BasicDataSource
并引入相应的jar包
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>7.0.47</version>
</dependency>
或者是 添加
destroy-method=""
例如:
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="">
原因是因为连接池会自动关闭,spring又去关闭一次所以出错,将bean的关闭方法设为空即可,有红色波浪线不用管,可以直接运行。

Failed to unregister the JMX name: org.apache.commons.dbcp2:name=xxx,type=BasicDataSource的更多相关文章

  1. Dbcp2抛出org.apache.commons.dbcp2.LifetimeExceededException

    三月 24, 2016 5:16:33 下午 org.apache.commons.dbcp2.BasicDataSource onSwallowException 警告: An internal o ...

  2. 使用ThreadLocal、Apache的dbutils的QueryRunner和dbcp2数据库连接池的BasicDataSource封装操作数据库工具

    package hjp.smart4j.framework.helper; import hjp.smart4j.framework.util.CollectionUtil; import hjp.s ...

  3. MyBatis笔记----(2017年)最新的报错:Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [com/ij34/mybatis/applicationContext.xml]; nested e

    四月 05, 2017 4:56:11 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRef ...

  4. java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.dbcp2.Ba ...

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

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

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

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

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

随机推荐

  1. 【转载】uwp 获取系统字体库

    效果图: 要获取到字体库首先要在 NuGet 添加 SharpDx.Direct2D1  api: /// <summary> /// 获取系统字体库列表 /// </summary ...

  2. 【js】关于正则表达式

    正则表达式描述了字符的模式对象 语法: var patt=new RegExp(pattern,modifiers); 或更简单的方法 var patt=/pattern/modifiers; 模式描 ...

  3. 【BZOJ4755】 [Jsoi2016]扭动的回文串

    BZOJ4755 [Jsoi2016]扭动的回文串 Solution 考虑对于他给出的 A中的一个回文串: B中的一个回文串: 或者某一个回文的扭动字符串S(i,j,k) 这样子几个限制,我们1,2就 ...

  4. nginx root&alias 文件路径配置

    nginx 指定文件路径有两种方式 root 和 alias,root 与 alias 主要区别在于 nginx 如何解释 location 后面的 uri,这会使两者分别以不同的方式将请求映射到服务 ...

  5. 3DMax——室内设计:墙体+吊顶

    1.导入CAD平面图 2.将导入的平面图全部选中→颜色设置为其他颜色→设置为组(设置为组,是为了后期选材质方便) 3.选中图形,选择移动工具,输入坐标为0,右键选择冻结当前选择 4.右键“角度捕捉切换 ...

  6. Linux CPU实时监控工具

    注:ubuntu需要安装sysstat: sudo apt install sysstat [root@testDb ~]# mpstat 1 10    ---显示操作系统内核版本 以及硬件配置   ...

  7. JDK提供的四种线程池代码详解

    一.线程池什么时候使用,会给我们带来什么好处? 如果很多用户去访问服务器,用户访问服务器的时间是非常短暂的,那么有可能在创建线程和销毁线程上花费的时间会远远大于访问所消耗的时间,如果采用线程池会使线程 ...

  8. Java之ServiceLoader

    转载请注明源出处:http://www.cnblogs.com/lighten/p/6946683.html 1.简介 JDK1.6之后,java.util包下多了一个类ServiceLoader,其 ...

  9. Redis for Windows

    要求 必备知识 熟悉基本编程环境搭建. 运行环境 windows 7(64位); redis64-2.8.17 下载地址 环境下载 什么是Redis redis是一个key-value存储系统.和Me ...

  10. C语言使用hiredis访问redis

    Hiredis 是Redis数据库的简约C客户端库.它是简约的,因为它只是增加了对协议的最小支持,但是同时它使用了一个高级别的 printf-like API,所以对于习惯了 printf 风格的C编 ...