grails链接mysql_Grails和MySQL连接异常

我有一个正在生产的grails应用程序.今天早上,我被告知服务器无法解析的事实. Tomcat在旋转.我进行了研究,发现它与MySQL有关,导致闲置8个小时后连接超时. I have found examples on stackoverflow人有类似的问题.但是,所有这些人都提到,如果他们再次命中服务器并刷新了连接.对我来说,该站点完全关闭了,Tomcat无法响应.听起来这里还有其他作用吗?

Tomcat日志中的最后一个异常

2011-Aug-30 23:58:43,283 [TP-Processor19] org.hibernate.util.JDBCExceptionReporter

ERROR The last packet successfully received from the server was 37,118,147 milliseconds ago. The last packet sent successfully to the server was 37,122,138 milliseconds ago. \nis longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing \nthe server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

2011-Aug-30 23:58:43,290 [TP-Processor19] org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver

ERROR Exception occurred when processing request: [GET] /picks/ncaafb

Stacktrace follows:

java.net.SocketException: Connection timed out

at java.net.SocketOutputStream.socketWrite0(Native Method)

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)

at java.net.SocketOutputStream.write(SocketOutputStream.java:136)

at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)

at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)

at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3302)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1940)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)

at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)

at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)

at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)

at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)

at sportsdb.Season.getCurrentNCAAFootballSeason(Season.groovy:93)

at PicksController$_closure2.doCall(PicksController.groovy:60)

at PicksController$_closure2.doCall(PicksController.groovy)

at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)

at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)

at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)

at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)

at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)

at java.lang.Thread.run(Thread.java:662)

2011-Aug-30 23:58:43,315 [TP-Processor19] org.hibernate.util.JDBCExceptionReporter

ERROR Already closed.

2011-Aug-30 23:58:43,315 [TP-Processor19] org.hibernate.util.JDBCExceptionReporter

ERROR Already closed.

2011-Aug-30 23:58:43,316 [TP-Processor19] org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet

ERROR HandlerInterceptor.afterCompletion threw exception

org.hibernate.exception.GenericJDBCException: Cannot release connection

at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)

at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)

at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)

at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)

at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)

at java.lang.Thread.run(Thread.java:662)

Caused by: java.sql.SQLException: Already closed.

at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114)

at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191)

at $Proxy7.close(Unknown Source)

... 6 more

我的计划是实施上面链接中提到的解决方案,但是我想确保没有其他明显的问题在进行,因为我们得到的结果有些不同(它们的连接令人耳目一新,而我的却没有).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值