首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

最近服务器总是出现这样的有关问题

2014-01-19 
最近服务器总是出现这样的问题项目运行在公网里,一开始运行很正常,但是隔个2,3天就会出现以上错误,一开始

最近服务器总是出现这样的问题
最近服务器总是出现这样的有关问题最近服务器总是出现这样的有关问题
最近服务器总是出现这样的有关问题
项目运行在公网里,一开始运行很正常,但是隔个2,3天就会出现以上错误,一开始我们的解决方法就是删除tomcat下work的文件夹内容。然后关掉java的进程重启tomcat的就好了,可是使用一段时间就会这样。

Spring的配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="byName">
<context:component-scan base-package="/"></context:component-scan>
<!-- =============================================================== -->
<!-- 配置数据库信息  hibernate                                                         -->
<!-- =============================================================== -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml">
</property>
</bean>

<!--事物管理-->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 启动注解 -->
<tx:annotation-driven transaction-manager="transactionManager" />

</beans>


hibernate的配置文件

<?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="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.url">jdbc:mysql://localhost:3306/database?autoReconnect=true</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="format_sql">true</property>
<property name="show_sql">true</property>
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_query_cache">true</property>
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuuu.hbm.xml" />
<mapping resource="com/entity/uuu.hbm.xml" />
</session-factory>

</hibernate-configuration>

[解决办法]
你的程序和数据库连接稳定吗?
[解决办法]
是不是代码实现有问题,有资源泄露?
[解决办法]
应该是程序的问题吧。事务没有提交
------解决方案--------------------


mysql数据库 ,会断开连接的 , 做个定时去检查是否连接,没连接就生成个sessionFactory
[解决办法]
这种情况就要设置连接池了。
[解决办法]
很明显的数据库建立和连接出现了问题,要确定你的数据库连接问题才行啊

热点排行