spring +Hibernate配置连接数据库, 10C

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

Caused by: org.hibernate.TransactionException: rollback failed
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:215)

Caused by: org.hibernate.TransactionException: unable to rollback against JDBC connection
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doRollback(JdbcTransaction.java:167)

Caused by: java.sql.SQLRecoverableException: IO Error: Connection reset
at oracle.jdbc.driver.T4CConnection.doRollback(T4CConnection.java:650)

Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196)

Caused by: java.sql.SQLRecoverableException: IO Error: Connection timed out
at oracle.jdbc.driver.T4CConnection.doRollback(T4CConnection.java:650)

Caused by: java.net.SocketException: Connection timed out
at java.net.SocketInputStream.socketRead0(Native Method)

是每次重启了Tomcat过段时间登录就会出现这个错误,重启后有段时间是正常的,在本地代码报错的是一个很简单的查询语句,在windows环境下能正常运行,在linux下隔断时间就会出现这个错误,用的容器是Tomcat

2个回答

把Hibernate的connection.autocommit设置为false 因为查询不能使用事物和rollback

luowen1991
luowen1991 这个设置了,还是会出现同样的问题,
2 年多之前 回复

有没有大佬帮忙解答下呢

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问