luowen1991
luowen1991
采纳率0%
2017-06-07 02:55 阅读 1.2k

spring +Hibernate配置连接数据库,

10

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条回答 默认 最新

  • qq_23292875 Hefei19881002 2017-06-07 03:04

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

    点赞 评论 复制链接分享
  • luowen1991 luowen1991 2017-06-07 03:41

    有没有大佬帮忙解答下呢

    点赞 评论 复制链接分享

相关推荐