關於hibernate使用c3p0連線池的問題.

AdonChen發表於2007-07-08
曾經一個已經投入執行的專案,是用struts+hibernate元件,後來再把工程開啟來執行時,配置不變的情況下,卻提示:
10:40:11,046 INFO C3P0Registry:77 - Initializing c3p0-0.9.0 [built 11-July-2005 00:43:29 -0400; debug? true; trace: 10]
10:40:11,562 INFO PoolBackedDataSource:257 - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1606bf5 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@196c0a0 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 196c0a0, idleConnectionTestPeriod -> 100, initialPoolSize -> 10, maxIdleTime -> 100, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@29d838 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 29d838, jdbcUrl -> jdbc:microsoft:sqlserver://localhost:1433, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 1606bf5, numHelperThreads -> 3 ]
10:41:14,093 WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@f8db08 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
10:41:14,515 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/D:/Tomcat/work/Catalina/localhost/KBPM/loader/ehcache-failsafe.xml
10:41:15,281 WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4dd413 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
10:42:29,546 WARN BasicResourcePool:1222 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@19d56e9 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
10:42:29,546 ERROR JDBCExceptionReporter:72 - Connections could not be acquired from the underlying database!
10:42:29,578 ERROR BaseHibernateDAO:204 - 查詢資料庫失敗
10:42:29,578 INFO ConfigConstants:40 - 呼叫getProperty
10:42:29,578 WARN RequestProcessor:516 - Unhandled Exception thrown: class java.lang.NullPointerException
----------------------------------------------------
hibernate的配置檔案關於c3p0的程式碼片段如下:
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">30</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
<!-- DEPRECATED very expensive property name="c3p0.validate>-->
其中c3p0.acquire_increment曾設成1,10,100,31如今是設成30,但都是一樣的效果,請熟悉的人指點一下原因.

相關文章