日期:2014-05-20  浏览次数:20884 次

C3P0+hibernate出现错误!求解释
Java code

 Level: DEBUG
   Time: 2011-11-28 19:25:48,805
 Method: com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:564)
Message: com.mchange.v2.c3p0.impl.NewPooledConnection@1458657 closed by a client.
java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:564)
    at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
    at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:958)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

  Level: DEBUG
   Time: 2011-11-28 19:25:48,805
 Method: com.mchange.v2.resourcepool.BasicResourcePool.cullExpired(BasicResourcePool.java:1450)
Message: FINISHED check for expired resources.  [com.mchange.v2.resourcepool.BasicResourcePool@1bb326c]

  Level: DEBUG
   Time: 2011-11-28 19:25:48,806
 Method: com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:476)
Message: Successfully destroyed PooledConnection: com.mchange.v2.c3p0.impl.NewPooledConnection@1458657

  Level: DEBUG
   Time: 2011-11-28 19:25:48,806
 Method: com.mchange.v2.resourcepool.BasicResourcePool.incrementPendingAcquires(BasicResourcePool.java:400)
Message: incremented pending_acquires: 1

  Level: DEBUG
   Time: 2011-11-28 19:25:48,807
 Method: com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:961)
Message: Successfully destroyed resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1458657

  Level: DEBUG
   Time: 2011-11-28 19:25:48,829
 Method: com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:217)
Message: com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@dd8e0d.acquireResource() returning. 

  Level: DEBUG
   Time: 2011-11-28 19:25:48,830
 Method: com.mchange.v2.resourcepool.BasicResourcePool.trace(BasicResourcePool.java:1620)
Message: trace com.mchange.v2.resourcepool.BasicResourcePool@1bb326c [managed: 2, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@16d3536)

  Level: DEBUG
   Time: 2011-11-28 19:25:48,830
 Method: com.mchange.v2.resourcepool.BasicResourcePool.decrementPendingAcquires(BasicResourcePool.java:418)
Message: decremented pending_acquires: 0




C3P0代码
Java code


    <!-- 定义使用C3P0连接池的数据源 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <!-- 指定连接数据库的JDBC驱动 -->
        <property name="driverClass">
             <value>${driverClassName}</value>
         </property>
        <!-- 连接数据库所用的URL -->
        <property name="jdbcUrl">
            <value>${url}</value>
        </property>
        <!-- 连接数据库的用户名 -->
        <property name="user">
            <value>${userName}</value>
        </property>
        <!-- 连接数据库的密码 -->
        <property name="password">
            <value>${password}</value>
        </property>
        <!-- 设置数据库连接池的最大连接数 -->
        <property name="maxPoolSize">
            <value>${maxPoolSize}</value>
        </property>
        <!-- 设置数据库连接池的最小连接数 -->
        <property name="minPoolSize">
            <value>${minPoolSize}</value>
        </property>
        <!-- 设置数据库连接池的初始化连接数 -->
        <property name="initialPoolSize">
            <value>${initialPoolSize}</value>
        </property>
        <!-- 设置数据库连接池的连接的最大空闲时间,单位为秒 -->
        <property name="maxIdleTime">
            <value>${maxIdleTime}</value>
        </property>
    </bean>