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

An attempt by a client to checkout a Connection has timed out 急、急、急、急、
数据库是Mysql的  
 在linux系统上 和mysql一台机器  
 启动会没访问多长时间就报:
 An attempt by a client to checkout a Connection has timed out  


 以下是applicationContext.xml



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"  
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"  
xsi:schemaLocation="http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context  
http://www.springframework.org/schema/context/spring-context-2.5.xsd  
http://www.springframework.org/schema/aop  
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd  
http://www.springframework.org/schema/tx  
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  
<!-- 自动搜索全包 -->  
<context:component-scan base-package="*"/>  

<!-- JMS配置-->  
  <!--import resource='jmsContext.xml' /--> 
  
  <!-- 加载数据库连接配置文件 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>

  <bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<!-- 指定连接数据库的驱动 -->
<property name="driverClass" value="${jdbc.driverClassName}" />
<!-- 指定连接数据库的URL -->
<property name="jdbcUrl" value="${jdbc.url}" />
<!-- 指定连接数据库的用户名 -->
<property name="user" value="${jdbc.username}" />
<!-- 指定连接数据库的密码 -->
<property name="password" value="${jdbc.password}" />

<!-- 指定连接数据库连接池的最大连接数 -->
<property name="maxPoolSize" value="60" />
<!-- 指定连接数据库连接池的最小连接数 -->
<property name="minPoolSize" value="2" />
<!-- 指定连接数据库连接池的初始化连接数 -->
<property name="initialPoolSize" value="5" />
<!-- 指定连接数据库连接池的连接的最大空闲时间 -->
<property name="maxIdleTime" value="20" />
<!--当连接池连接耗尽时,客户端获取连接等待所需时间-->
<property name="checkoutTimeout" value="20000"/>
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="5"/>


</bean>

<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<!-- value>com.wificity.community.model.extend</value -->  
<value>com.businessserver.mercant.model</value>  
<value>com.businessserver.mercant.model.extend</value>  
<value>com.businessserver.game.model.extend</value>  
<value>com.businessserver.users.model</value>  
<value>com.businessserver.game.model</value>