导入项目报错Could not initialize class com.mchange.v2.c3p0.ComboPooledDataSource

Troyturk 2015-09-21 02:51:38
我又来了。。。
然后导入的还是那个maven项目
然后测试用例的时候报错:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ReadDataSource' defined in class path resource [mysql-datasource-bean-test.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.mchange.v2.c3p0.ComboPooledDataSource
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1039) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:985) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934) ~[spring-context-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) ~[spring-context-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:120) ~[spring-test-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~[spring-test-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:102) ~[spring-test-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:246) ~[spring-test-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:69) ~[spring-test-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:95) ~[spring-test-3.2.12.RELEASE.jar:3.2.12.RELEASE]
... 25 common frames omitted

网上说Could not initialize class com.mchange.v2.c3p0.ComboPooledDataSource这个错误是因为缺少jar包c3p0-0.9.1.2.jar
但是我找了一下build path里面的maven dependencies是有这个jar包的
那么问题来了,应该怎么改错呢~
...全文
1443 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 5 楼 Troyturk 的回复:
[quote=引用 4 楼 shijing266 的回复:] [quote=引用 3 楼 Troyturk 的回复:] 解决了,貌似是pom.xml里面日志配置的问题
日志配置? [/quote] 对啊,冲突了貌似 注解掉org.slf4j就可以了[/quote] 是既存在log4j又存在slf4j?
Troyturk 2015-09-23
  • 打赏
  • 举报
回复
引用 4 楼 shijing266 的回复:
[quote=引用 3 楼 Troyturk 的回复:] 解决了,貌似是pom.xml里面日志配置的问题
日志配置? [/quote] 对啊,冲突了貌似 注解掉org.slf4j就可以了
  • 打赏
  • 举报
回复
引用 3 楼 Troyturk 的回复:
解决了,貌似是pom.xml里面日志配置的问题
日志配置?
Troyturk 2015-09-22
  • 打赏
  • 举报
回复
解决了,貌似是pom.xml里面日志配置的问题
Troyturk 2015-09-21
  • 打赏
  • 举报
回复
引用 1 楼 shijing266 的回复:
去项目的classes的lib目录,看看这个jar存不存在
它是很多个子项目其中的一个 然后没有lib文件夹 jar包都是放在maven dependencies里面 但是我在另一个子项目web里面看到了lib文件夹,它里面有这个jar文件的
  • 打赏
  • 举报
回复
去项目的classes的lib目录,看看这个jar存不存在

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧