大家帮帮忙:小型宠物店系统用了几分钟后特慢?
大家好,我用struts+spring+hibernate做了一个小型宠物店,目前只有两个数据表,一个用户信息表和宠物表,启动Tomcat后,登录系统正常,但是在进行增删改操作几分钟后,退出系统再登录就非常慢了,基本上是没有反应. 重新启动Tomcat后便好了.
这是怎么回事啊?
注:
1. Tomcat未做任何设置;
2.web.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>home.jsp</welcome-file>
</welcome-file-list>
</web-app>
3. applicationContext.xml中主要配置如下:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@localhost:1521:myoracle</value>
</property>
<property name="username">
<value>test</value>
</property>
<property name="password">
<value>123456</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>org/chendongfa/po/Petlist.hbm.xml</value>
<value>org/chendongfa/po/Userinfo.hbm.xml</value></list>
</property></bean>
<bean id="petlistDAO" class="org.chendongfa.dao.PetlistDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
4. 对数据表的操作只有简单的增删改,数据量不到10条.
大家帮忙看看,会是什么原因? 是不是跟hibernate的配置有关?
------解决方案--------------------最大的可能是数据库连接没有释放
------解决方案--------------------用jprofile监控下看看
数据库操作有没有释放链接等
------解决方案--------------------