08-12
20
com.mysql.jdbc.CommunicationsException
作者:Java伴侣 日期:2008-12-20
MYSQL在服务端8小时不活动自动关闭。。
之后程序异常
解决方案:
MySQL closes connections after 8 hours of inactivity.
And even if you set the autoreconnect=true, you should be catching
SQLExceptions in your application and dealing with them.
But you also need to becareful for using autoReconnect function,
because autoReconnect will be depcreated in the future.
之后程序异常
复制内容到剪贴板 程序代码
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1963) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2375) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2874) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715) at com.mysql.jdbc.Connection.execSQL(Connection.java:3249) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1403) at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68) at org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$c2f715fa.executeQuery(<generated>) at com.chinajavaworld.base.database.DbUser.loadFromDb(DbUser.java:191) at com.chinajavaworld.base.database.DbUser.<init>(DbUser.java:89) at com.chinajavaworld.base.database.DbUserManager.lookupUser(DbUserManager.java:51) at com.chinajavaworld.base.database.DbUserManager.getUserID(DbUserManager.java:68) at com.chinajavaworld.base.database.DbUserManager.getUser(DbUserManager.java:60) at com.chinajavaworld.base.database.DbAuthFactory.createAuthTokenFromCache(DbAuthFactory.java:103) at com.chinajavaworld.base.AuthFactory.getAuthTokenFromCache(AuthFactory.java:51) at com.chinajavaworld.base.AuthFactory.createSessionUserInfo(AuthFactory.java:200) at com.chinajavaworld.base.AuthFactory.loginUser(AuthFactory.java:189) at com.chinajavaworld.base.action.LoginAction.execute(LoginAction.java:240) at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:283) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:166) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.chinajavaworld.base.action.UcObjectLoaderInterceptor.intercept(UcObjectLoaderInterceptor.java:32) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.webwork.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:71) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164) at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116) at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:272) at com.chinajavaworld.base.util.UcWebWorkServlet.service(UcWebWorkServlet.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:92) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106) at com.caucho.filters.GzipFilter.doFilter(GzipFilter.java:208) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511) at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520) at com.caucho.util.ThreadPool.run(ThreadPool.java:442) at java.lang.Thread.run(Thread.java:619) ** END NESTED EXCEPTION ** Last packet sent to the server was 1 ms ago.
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2586)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2874)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1403)
at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68)
at org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$c2f715fa.executeQuery(<generated>)
at com.chinajavaworld.base.database.DbUser.loadFromDb(DbUser.java:191)
at com.chinajavaworld.base.database.DbUser.<init>(DbUser.java:89)
at com.chinajavaworld.base.database.DbUserManager.lookupUser(DbUserManager.java:51)
at com.chinajavaworld.base.database.DbUserManager.getUserID(DbUserManager.java:68)
at com.chinajavaworld.base.database.DbUserManager.getUser(DbUserManager.java:60)
at com.chinajavaworld.base.database.DbAuthFactory.createAuthTokenFromCache(DbAuthFactory.java:103)
at com.chinajavaworld.base.AuthFactory.getAuthTokenFromCache(AuthFactory.java:51)
at com.chinajavaworld.base.AuthFactory.createSessionUserInfo(AuthFactory.java:200)
at com.chinajavaworld.base.AuthFactory.loginUser(AuthFactory.java:189)
at com.chinajavaworld.base.action.LoginAction.execute(LoginAction.java:240)
at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:283)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:166)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.chinajavaworld.base.action.UcObjectLoaderInterceptor.intercept(UcObjectLoaderInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.webwork.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:71)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:272)
at com.chinajavaworld.base.util.UcWebWorkServlet.service(UcWebWorkServlet.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.caucho.filters.GzipFilter.doFilter(GzipFilter.java:208)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520)
at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
at java.lang.Thread.run(Thread.java:619)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2586)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2874)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1403)
at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68)
at org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$c2f715fa.executeQuery(<generated>)
at com.chinajavaworld.base.database.DbUser.loadFromDb(DbUser.java:191)
at com.chinajavaworld.base.database.DbUser.<init>(DbUser.java:89)
at com.chinajavaworld.base.database.DbUserManager.lookupUser(DbUserManager.java:51)
at com.chinajavaworld.base.database.DbUserManager.getUserID(DbUserManager.java:68)
at com.chinajavaworld.base.database.DbUserManager.getUser(DbUserManager.java:60)
at com.chinajavaworld.base.database.DbAuthFactory.createAuthTokenFromCache(DbAuthFactory.java:103)
at com.chinajavaworld.base.AuthFactory.getAuthTokenFromCache(AuthFactory.java:51)
at com.chinajavaworld.base.AuthFactory.createSessionUserInfo(AuthFactory.java:200)
at com.chinajavaworld.base.AuthFactory.loginUser(AuthFactory.java:189)
at com.chinajavaworld.base.action.LoginAction.execute(LoginAction.java:240)
at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:283)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:166)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.chinajavaworld.base.action.UcObjectLoaderInterceptor.intercept(UcObjectLoaderInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.webwork.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:71)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:164)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:272)
at com.chinajavaworld.base.util.UcWebWorkServlet.service(UcWebWorkServlet.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.caucho.filters.GzipFilter.doFilter(GzipFilter.java:208)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520)
at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
at java.lang.Thread.run(Thread.java:619)
解决方案:
MySQL closes connections after 8 hours of inactivity.
And even if you set the autoreconnect=true, you should be catching
SQLExceptions in your application and dealing with them.
But you also need to becareful for using autoReconnect function,
because autoReconnect will be depcreated in the future.
评论: 0 | 引用: 0 | 查看次数: 614
发表评论