apache-tomcat-6.0.16服务器上struts1+hiernate框架开发的JSP程序,数据库用的是ORACLE9I。都放在托管服务器上,通过外网访问。
问题:网页过段时间后,速度就非常慢,有时候根本就打不开,但是重新启动tomcat后,就恢复正常。不明白是什么问题,怀疑是不是hiernate的配置没做好。以下就是我的配置:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration> <session-factory>
<property name="connection.username">elctheftsys</property>
<property name="connection.url">
jdbc:oracle:thin:@127.0.0.1:1521:shxy
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="myeclipse.connection.profile">
elctheftsys
</property>
<property name="connection.password">shenzhen</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="show_sql">true</property>
<mapping resource="com/pojo/YTermlist.hbm.xml" />
<mapping resource="com/pojo/YPhotohis.hbm.xml" />
<mapping resource="com/pojo/YWeatherdatalist.hbm.xml" />
<mapping resource="com/pojo/YInsulatorPullObliquity.hbm.xml" />
<mapping resource="com/pojo/YLineTemperature.hbm.xml" />
<mapping resource="com/pojo/YCheckid.hbm.xml" />
<mapping resource="com/pojo/YDataThresholdValue.hbm.xml" />
<mapping resource="com/pojo/YFbtj.hbm.xml" /> </session-factory></hibernate-configuration>
请高手帮忙解决。

解决方案 »

  1.   

    如果是你一个人用出现这种情况,多数资源没有被释放,是数据库连接没有及时被关闭,而且再加上TOMCAT默认的JVM内存本来也不大。
      

  2.   

    慢的时候连上ORACLE9I去看看tomcat过来的链接数有多少?是不是太多了,用完没有关。
    改成连接pool试试。
    另外tomcat启动是你给了多少内存?
      

  3.   

    public List path_find(String path)
    {

    try {
    Query q = getSession().createQuery("from YLineTemperature where  termid=? order by id desc");
      q.setCacheable(true);
    q.setString(0, path);


    return q.list();
    } catch (Exception e) {
    // TODO: handle exception
    return null;
    } finally
    {

    getSession().close();}


    }是否需要加getSession().close();}?
      

  4.   

    把tomcat\webapps下的项目删掉,进入bin目录下双击startup.bat试试看慢不慢
      

  5.   

    昨天又观察了一下,控制台提示内存益出,此时不能与数据库进行交互了,但是静态网页还能够打开。重启后 又正常了严重:an exception or error occurred in the container during the request processing严重:error finishing response
    java.lang.outofmemoryerror:java heap space
    等等这些错误   请高手指点如何解决
      

  6.   

    如何修改TOMCAT的内存?网上讲了很多,好象都没什么用