应用程序启动一段时间后出现耗尽结果集异常
我们有一个在 JBOSS 上运行 Oracle 的 Java 应用程序。我们还使用框架seam 和hibernate。
当我们的应用程序启动并运行用于生产时,应用程序启动几个小时后,我们遇到这样的问题:
crms_log_27_may.txt:10:47:09,170 ERROR [STDERR] java.sql.SQLException: Exhausted Resultset
crms_log_27_may.txt:10:47:09,170 ERROR [STDERR] java.sql.SQLException: Exhausted Resultset
crms_log_27_may.txt:10:47:09,170 ERROR [STDERR] java.sql.SQLException: Exhausted Resultset
crms_log_27_may.txt:10:22:18,135 ERROR [STDERR] Caused by: java.sql.SQLException: Closed Connection
crms_log_27_may.txt:10:24:10,231 ERROR [STDERR] Caused by: java.sql.SQLException: Closed Connection
我检查了所有代码,发现我使用了 rs.next() 并关闭正确地放置对象。
We have a java application running on JBOSS with Oracle. We are also using the frameworks seam and hibernate.
When our application is up and running for production, after few hours of the start of the application we encounter a problem like this:
crms_log_27_may.txt:10:47:09,170 ERROR [STDERR] java.sql.SQLException: Exhausted Resultset
crms_log_27_may.txt:10:47:09,170 ERROR [STDERR] java.sql.SQLException: Exhausted Resultset
crms_log_27_may.txt:10:47:09,170 ERROR [STDERR] java.sql.SQLException: Exhausted Resultset
crms_log_27_may.txt:10:22:18,135 ERROR [STDERR] Caused by: java.sql.SQLException: Closed Connection
crms_log_27_may.txt:10:24:10,231 ERROR [STDERR] Caused by: java.sql.SQLException: Closed Connection
I checked all my code and found that I used rs.next()
and closed the objects properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果某处存在连接池,则连接在一段时间不活动后可能会失效,您需要重新配置连接池来检测这种情况,以便只获得良好的连接。
这通常是通过一个不改变任何内容的简单查询来完成的,例如“从双中选择 1”,如果响应正确,则连接良好,您就可以得到它。如果没有,它将被丢弃并为您创建一个新的。
If there is a connection pool somewhere the connections might go stale after a period of inactivity, and you need to reconfigure the connection pool to detect this so you only get good connections.
This is typically done with a simple query not changing anything, like "select 1 from dual" and if that responds correctly the connection is good and you get it. If it doesn't it is discarded and a new created for you.