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>
请高手帮忙解决。
问题:网页过段时间后,速度就非常慢,有时候根本就打不开,但是重新启动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>
请高手帮忙解决。
改成连接pool试试。
另外tomcat启动是你给了多少内存?
{
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();}?
java.lang.outofmemoryerror:java heap space
等等这些错误 请高手指点如何解决