我用struts2+spring+hibernate3连数据库mysql,只要访问8次action,ie就停顿了,就一直在加载,控制台也没反应。只能重启服务器tomcat,重启之后也只能访问8次。mysql中最大连接数配置max_connections=1024
spring-common.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/facebs?useunicode=true&characterEncoding=utf-8</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>344</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
>
<property name="mappingResources">
<list>
<value>com/idbao/common/hibernate/AccountState.hbm.xml</value>
<!--........省略一部分<value>--> </list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.max_size">20</prop>
<prop key="hibernate.c3p0.timeout">1800</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="smsUtil" class="com.idbao.common.util.SmsUtil">
</bean>
</beans>
spring-service.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="memberInfoServiceTarget"
class="com.idbao.member.service.impl.MemberInfoServiceImpl">
<property name="memberInfoDao">
<ref bean="memberInfoDao"/>
</property>
<property name="smsUtil">
<ref bean="smsUtil"/>
</property>
</bean>
<bean id="memberInfoService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
lazy-init="true">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED, -MemberInfoException</prop>
</props>
</property>
<property name="target">
<ref bean="memberInfoServiceTarget"/>
</property>
</bean>
<!--.....省略一部分bean-->
</beans>
daoImp.java
public class daoImpl implements dao {
private HibernateTemplate hibernateTemplate;
public void setHibernateTemplate(HibernateTemplate hibernateTemplate){
this.hibernateTemplate=hibernateTemplate;
}
public CateringBaseParameter findCatering(Integer id) throws DataAccessException {
List list=hibernateTemplate.find("from CateringBaseParameter where id=?",id);
if(list.size()!=0)
return (CateringBaseParameter) list.get(0);
return null;
}
}
请指教有什么错误,不胜感激!