ssh 事务不能回滚 Could not roll back Hibernate transaction; nested exception is org.hibernate.Transaction

调试没问题,发布到服务器上一段时间报以下异常

org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed
org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:677)

问题原因:mysql 数据库将hibernate 连接给关闭了,

解决1:

hibernate配置数据源

proxool数据源

在src目录下添加Proxool.xml文件与struts.xml hiberntate.xml同目录




  
   DBPool
    jdbc:mysql://localhost:3306/house
    com.mysql.jdbc.Driver
    
      
      
    
    10
    select CURRENT_DATE 
    
hiberante配置 




	
		org.hibernate.connection.ProxoolConnectionProvider
		DBPool
		Proxool.xml
		true
		
		update

		
		
	

c3p0数据源




	
		
		 org.hibernate.connection.C3P0ConnectionProvider 
			20
			5 
			120 
			100 
			120 
			2 
			com.mysql.jdbc.Driver 
			admin 
			jdbc:mysql://********2 
			admin
			admin
			jdbc:mysql://localhost:3306/house 
			root
			thread
			org.hibernate.dialect.MySQL5Dialect 
			update 


		
		
	


二、修入mysql my.ini文件 找到这个位置

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]
wait_timeout=1814400 
# The TCP/IP Port the MySQL Server will listen on
port=3306

主要是修秘诀wait-timeout  单位是秒 设的值表示21天

你可能感兴趣的:(ssh 事务不能回滚 Could not roll back Hibernate transaction; nested exception is org.hibernate.Transaction)