搭建struts+hibernate+spring框架的时候,出现了c3p0连接池报死锁,当时愣了好久,网上去查了资料,有人说::
解决办法:
把max_statements设置为0。
c3p0在同时关闭statement和connection的时候,或者关闭他们之间的时间很短的时候,有时候connection并没有被关闭,因为有些preparedstatement还在被cached住。这是c3p0的作者自己说的。
其实,我的情况不是这样的,当时我搭建完环境,忘记新建数据库了,新建数据库后,我的问题就解决了,我想,如果你也整好在搭建Demo环境,出现这个问题,也不应该是上面的那种情况导致的.
警告: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@200d0c -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! 2013-9-13 16:25:18 com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDet ector run 警告: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@200d0c -- APPARENT DEADLOCK!!! Complete Status: Managed Threads: 3 Active Threads: 3 Active Tasks: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@bdb859 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@191f61 c (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1b4b24 d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2) Pending Tasks: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@260829 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@e1fb6c Pool thread stack traces: Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5 ,main] java.lang.Thread.sleep(Native Method) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(Ba sicResourcePool.java:1805) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run (ThreadPoolAsynchronousRunner.java:547) Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5 ,main] java.lang.Thread.sleep(Native Method) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(Ba sicResourcePool.java:1805) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run (ThreadPoolAsynchronousRunner.java:547) Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5 ,main] java.lang.Thread.sleep(Native Method) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(Ba sicResourcePool.java:1805) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run (ThreadPoolAsynchronousRunner.java:547)