Java Spring中遇到这样的异常?
问题描述
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [numThreadsAwaitingCheckoutDefaultUser] ] has been closed() -- you can no longer use it. at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:245) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:427) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy83.checkAccountStatus(Unknown Source) at com.mc.arkcloud.server.deal.timer.IscsiNetStoreChecker.run(IscsiNetStoreChecker.java:48) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505)Caused by: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [numThreadsAwaitingCheckoutDefaultUser] ] has been closed() -- you can no longer use it. at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:204) ... 12 more
问题解答
回答1:因为没有加class12.jar包问题导致数据库连接不稳定,试一试class12.jar包加入就好了
回答2:数据库链接已经被关闭了,先看看直接连接有没有问题,没有问题的话可能是从连接池里拿的连接已经超时断开了,你看看连接池的配置和数据库本身的超时配置有没有问题
相关文章:
1. docker-compose 为何找不到配置文件?2. 在mac下出现了两个docker环境3. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?4. macos - mac下docker如何设置代理5. 在windows下安装docker Toolbox 启动Docker Quickstart Terminal 失败!6. angular.js - angular内容过长展开收起效果7. PHP中的$this代表当前的类还是方法?8. objective-c - iOS开发支付宝和微信支付完成为什么跳转到了之前开发的一个app?9. dockerfile - [docker build image失败- npm install]10. java - 我用Tomcat访问SQL server数据库时,出现以下错误,该怎么解决?