練功房推薦書單

  • 猛虎出柙雙劍合璧版--最新 OCA / OCP Java SE 7 Programmer 專業認證 (電子書)
  • 流浪教師存零股存到3000萬(全新增修版)(書+DVD)
  • 開始在關西自助旅行(京都‧大阪‧神戶‧奈良)(全新增訂版)
  • 不敗教主的300張股票存股術

MySQLNonTransientConnectionException RSS feed
討論區首頁 » JForum中文社群 JForum Chinese Users Community
發表人 內容
lynx286

九級學員

註冊時間: 2008/4/24
文章: 10
離線
我的论坛也是jforum,几个小时没人访问以后,再访问就会出现下面错误:


An error has occurred.

For detailed error information, please see the HTML source code, and contact the forum Administrator.

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure

Last packet sent to the server was 0 ms ago.

Query being executed when exception was thrown:

SELECT COUNT(pm.privmsgs_to_userid) AS private_messages, u.* FROM jforum_users u LEFT JOIN jforum_privmsgs pm ON pm.privmsgs_type = 1 AND pm.privmsgs_to_userid = u.user_id WHERE u.user_id = 1 GROUP BY pm.privmsgs_to_userid


我是Tomcat 5.5 + mysql

Thanks!
lynx286

九級學員

註冊時間: 2008/4/24
文章: 10
離線
以下是右键察看源文件的错误信息:

<!-- BEGIN ERROR STACK TRACE
net.jforum.exceptions.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure

Last packet sent to the server was 1 ms ago.

Query being executed when exception was thrown:

SELECT COUNT(pm.privmsgs_to_userid) AS private_messages, u.* FROM jforum_users u LEFT JOIN jforum_privmsgs pm ON pm.privmsgs_type = 1 AND pm.privmsgs_to_userid = u.user_id WHERE u.user_id = 1 GROUP BY pm.privmsgs_to_userid
at sun.reflect.GeneratedConstructorAccessor114.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3134)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1818)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at net.jforum.dao.generic.GenericUserDAO.selectById(GenericUserDAO.java:136)
at net.jforum.repository.SecurityRepository.load(SecurityRepository.java:94)
at net.jforum.repository.SecurityRepository.load(SecurityRepository.java:112)
at net.jforum.JForum.service(JForum.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure

Last packet sent to the server was 1 ms ago.

Query being executed when exception was thrown:

SELECT COUNT(pm.privmsgs_to_userid) AS private_messages, u.* FROM jforum_users u LEFT JOIN jforum_privmsgs pm ON pm.privmsgs_type = 1 AND pm.privmsgs_to_userid = u.user_id WHERE u.user_id = 1 GROUP BY pm.privmsgs_to_userid
... 35 more

URL is: /forums/list.page?null
END ERROR STACK TRACE-->

<html>
<head>
<title>Error</title>
</head>
<body>
<p style="color:red; font-weight:bold">An error has occurred.</p><p>For detailed error information, please see the HTML source code, and contact the forum Administrator.</p><pre class="pre-error"><i>com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure

Last packet sent to the server was 1 ms ago.

Query being executed when exception was thrown:

SELECT COUNT(pm.privmsgs_to_userid) AS private_messages, u.* FROM jforum_users u LEFT JOIN jforum_privmsgs pm ON pm.privmsgs_type = 1 AND pm.privmsgs_to_userid = u.user_id WHERE u.user_id = 1 GROUP BY pm.privmsgs_to_userid</i></pre>
</body>
</html>

andowson

七段學員
[Avatar]

註冊時間: 2007/1/2
文章: 711
來自: 台北
離線
您提到的SQL是UserModel.selectById,在generic_queries.sql裡面的內容如下:

UserModel.selectById = SELECT COUNT(pm.privmsgs_to_userid) AS private_messages, u.* \
FROM jforum_users u \
LEFT JOIN jforum_privmsgs pm ON pm.privmsgs_type = 1 AND pm.privmsgs_to_userid = u.user_id \
WHERE u.user_id = ? \
GROUP BY pm.privmsgs_to_userid

其中user_id = 1時表示使用者為訪客(anonymous),這個錯誤可能是Session Timeout或Connection Timeout時,系統關閉資料庫連線,造成查詢使用者資料的這個查詢無法執行成功,應該對系統沒有太嚴重的影響,可以不予理會。

參考資料:
http://bugs.mysql.com/bug.php?id=35353

分享經驗 累積智慧
[WWW]
 
討論區首頁 » JForum中文社群 JForum Chinese Users Community
前往:   
行動版