日期:2014-05-17  浏览次数:20613 次

ssh2整合,一用c3p0就出错!
ssh2整合,不用数据连接池,完全正常;换c3p0就出错!而且启动服务慢,请求响应也很慢!
这个c3p0有什么猫腻?我在applicationContext.xml中如下配置:
XML code

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
           <property name="location" value="classpath:dataSource.properties" />
    </bean>
    
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">  
      <property name="driverClass">  
      <value>${datasource.driverClassName} </value>  
      </property>  
      <property name="jdbcUrl">  
      <value>${datasource.url} </value>  
      </property>  
      <property name="user">  
      <value>${datasource.username} </value>  
      </property>  
      <property name="password">  
      <value>${datasource.password} </value>  
      </property>   
      <property name="initialPoolSize">  
      <value>${jdbc.initialPoolSize} </value>  
      </property>   
      <property name="minPoolSize">  
      <value>${jdbc.minPoolSize} </value>  
      </property>   
      <property name="maxPoolSize">  
      <value>${jdbc.maxPoolSize} </value>  
      </property>   
      </bean>  

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="mappingResources">
            <list>
                <value>ssh2/login/model/User.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                </prop>
                <prop key="show_sql">true</prop>
            </props>
        </property>
    </bean>


我也添加c3p0-0.9.1.jar包了,难道还需要其他包?请求半天,浏览器出现如下信息:
Struts Problem Report
Struts has detected an unhandled exception: 

Messages: A ResourcePool could not acquire a resource from its primary factory or source
Connections could not be acquired from the underlying database! 
Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database! 
 
File: com/mchange/v2/resourcepool/BasicResourcePool.java 
Line number: 1,319 

Stacktraces
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Conne