四月 05, 2017 4:56:11 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@41cf53f9: startup date
[Wed Apr 05 16:56:11 CST 2017]; root of context hierarchy
四月 05, 2017 4:56:11 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [com/ij34/mybatis/applicationContext.xml]
四月 05, 2017 4:56:11 下午 org.springframework.context.support.ClassPathXmlApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [org.apache.commons.dbcp.BasicDataSource]
for bean with name 'dataSource' defined in class path resource [com/ij34/mybatis/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.commons.dbcp.BasicDataSource]
for bean with name 'dataSource' defined in class path resource [com/ij34/mybatis/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1357)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:629)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1450)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:980)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:731)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.ij34.bean.Test.main(Test.java:22)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1402)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1349)
... 10 more

我用的是

然而在dbcp2.1.1里找不到

org.apache.commons.dbcp.BasicDataSource


所以改成这样

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource">

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的更多相关文章

  1. MyBatis笔记----报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ij34/mybatis/applicationContext.xml]: Invocation of init method failed; nested exception is org.sp

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

  2. 报Error creating bean with name 'dataSource' defined in class path resource 报错解决办法

    在学习spring boot 的数据库操作的时候,报了一串错误 对于初学spring boot的我来说,英语水平低,看不懂报错的信息,给我造成了很大的麻烦,花了我一天的时间,经过不懈的努力后终于让我找 ...

  3. Error creating bean with name 'dataSource' defined in class path resource 报错解决办法

    在学习spring boot 的数据库操作的时候,报了一串错误

  4. springboot启动报:Error creating bean with name 'dataSource' defined in class path resource

    需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.clas ...

  5. Spring AOP 报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXXXX' defined in class path resource..........

    完整报错如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'befo ...

  6. 解决:启动项目报错 java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

    前言:项目在 spring-mvc.xml 文件中配置了上传文件拦截,结果启动报错 java.lang.NoClassDefFoundError: org/apache/commons/fileupl ...

  7. 使用SpringMVC报错 Error creating bean with name 'conversionService' defined in class path resource [springmvc.xml]

    使用SpringMVC报错 Error creating bean with name 'conversionService' defined in class path resource [spri ...

  8. 报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]

    报这种错的原因基本上是applicationContext.xml文件中bean配置错误,错误如下: org.springframework.beans.factory.BeanCreationExc ...

  9. java数据库执行迁移报错Error creating bean with name 'flywayInitializer' defined in class path resource

    报错原因 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayI ...

随机推荐

  1. 谷歌浏览器中安装JsonView扩展程序

    实际开发工作中经常用到json数据,那么就会有这样一个需求:在谷歌浏览器中访问URL地址返回的json数据能否按照json格式展现出来. 比如,在谷歌浏览器中访问:http://jsonview.co ...

  2. [NewLife.XCode]反向工程(自动建表建库大杀器)

    NewLife.XCode是一个有10多年历史的开源数据中间件,支持nfx/netstandard,由新生命团队(2002~2019)开发完成并维护至今,以下简称XCode. 整个系列教程会大量结合示 ...

  3. Deeplearning.ai课程笔记--汇总

    从接触机器学习就了解到Andrew Ng的机器学习课程,后来发现又出来深度学习课程,就开始在网易云课堂上学习deeplearning.ai的课程,Andrew 的课真是的把深入浅出.当然学习这些课程还 ...

  4. for循环中let与var的区别,块级作用域如何产生与迭代中变量i如何记忆上一步的猜想

    我在前一篇讨论let与var区别的博客中,顺带一笔带过了let与var在for循环中的不同表现,虽然解释了是块级作用域的影响,但具体是怎么去影响的呢,我尝试的去理解了下,这篇博客主要从for循环步骤拆 ...

  5. 系统不支持WP开发

    好伤心,,,系统不支持WP开发... 买的ThinkPad S5 自带的win8,既不属于专业版,也不属于家庭版,,不属于各种版本. 其他条件都满足了.. 难道我要还系统吗??

  6. Spring Cloud Stream消费失败后的处理策略(四):重新入队(RabbitMQ)

    应用场景 之前我们已经通过<Spring Cloud Stream消费失败后的处理策略(一):自动重试>一文介绍了Spring Cloud Stream默认的消息重试功能.本文将介绍Rab ...

  7. 基于SSM框架贺州学院校园二手交易平台设计与实现

    前言 这个是我当时的毕业论文,分享出来,给同学们参考. 绪论 随着中国新四大发明的诞生,网购成了千千万万网友们购物的新方式,新的购物方式促进商业的发展,但随着人们生活水平的提高,许多新购置的物品用了没 ...

  8. 一个Fragment的实例

    @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method s ...

  9. WPF 绕圈进度条(一)

    在设计界面时,有时会遇到进度条,本次讲解如何设计自定义的绕圈进度条,直接上代码: 1.控件界面 <UserControl x:Class="ProgressBarControl&quo ...

  10. https创建请求UrL报错: 未能为 SSL/TLS 安全通道建立信任关系

    1.项目中异常报错如下: 2.百度结果:原来是 网站没有使用SSL证书或者是SSl证书失效了的缘故. 3.具体解决方案如下: )导入命名空间 using System.Net.Security; us ...