本地升级了下MySQL的版本,从5.6升为5.7,数据文件直接拷贝的,项目查询数据库报错:

Could not retrieve transation read-only status server

The last packet successfully received from the server was 20,519 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.

Software caused connection abort: recv failed.

详细错误如下:

  1. ### Cause: java.sql.SQLException: Could not retrieve transation read-only status server
  2. ; SQL []; Could not retrieve transation read-only status server; nested exception is java.sql.SQLException: Could not retrieve transation read-only status server
  3. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108)
  4. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
  5. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
  6. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
  7. at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
  8. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
  9. at com.sun.proxy.$Proxy28.selectList(Unknown Source)
  10. at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:231)
  11. at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
  12. at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
  13. at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
  14. at com.sun.proxy.$Proxy29.qryUsers(Unknown Source)
  15. at com.rxwx.service.system.impl.UserServiceImpl.qryUsers(UserServiceImpl.java:201)
  16. at com.rxwx.service.system.impl.UserServiceImpl$$FastClassBySpringCGLIB$$512368.invoke(<generated>)
  17. at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  18. at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
  19. at com.rxwx.service.system.impl.UserServiceImpl$$EnhancerBySpringCGLIB$$f68a7b66.qryUsers(<generated>)
  20. at com.rxwx.service.system.impl.UserServiceImpl$$FastClassBySpringCGLIB$$512368.invoke(<generated>)
  21. at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
  22. at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
  23. at com.rxwx.service.system.impl.UserServiceImpl$$EnhancerBySpringCGLIB$$ef3351f4.qryUsers(<generated>)
  24. at com.rxwx.realm.MyRealm.doGetAuthenticationInfo(MyRealm.java:120)
  25. at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
  26. at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
  27. at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
  28. at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
  29. at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
  30. at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
  31. at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
  32. at com.rxwx.controller.system.LoginController.doLogin(LoginController.java:89)
  33. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  34. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  35. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  36. at java.lang.reflect.Method.invoke(Method.java:498)
  37. at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  38. at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
  39. at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
  40. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
  41. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
  42. at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  43. at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
  44. at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
  45. at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
  46. at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
  47. at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
  48. at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
  49. at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
  50. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  51. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  52. at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  53. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  54. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  55. at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
  56. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  57. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  58. at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
  59. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  60. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  61. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  62. at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
  63. at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
  64. at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
  65. at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
  66. at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
  67. at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
  68. at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
  69. at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
  70. at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
  71. at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
  72. at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
  73. at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
  74. at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  75. at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  76. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  77. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  78. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
  79. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  80. at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
  81. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  82. at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
  83. at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
  84. at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  85. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  86. at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
  87. at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  88. at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
  89. at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
  90. at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  91. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  92. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  93. at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  94. at java.lang.Thread.run(Thread.java:745)
  95. Caused by: java.sql.SQLException: Could not retrieve transation read-only status server
  96. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
  97. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
  98. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
  99. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
  100. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:951)
  101. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:941)
  102. at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3936)
  103. at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3907)
  104. at com.mysql.jdbc.PreparedStatement.checkReadOnlySafeStatement(PreparedStatement.java:1258)
  105. at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1278)
  106. at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3051)
  107. at com.alibaba.druid.wall.WallFilter.preparedStatement_execute(WallFilter.java:619)
  108. at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3049)
  109. at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
  110. at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3049)
  111. at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167)
  112. at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:498)
  113. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  114. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  115. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  116. at java.lang.reflect.Method.invoke(Method.java:498)
  117. at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
  118. at com.sun.proxy.$Proxy84.execute(Unknown Source)
  119. at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
  120. at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
  121. at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
  122. at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
  123. at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
  124. at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
  125. at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:111)
  126. at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
  127. at com.sun.proxy.$Proxy82.query(Unknown Source)
  128. at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
  129. at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
  130. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  131. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  132. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  133. at java.lang.reflect.Method.invoke(Method.java:498)
  134. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)
  135. ... 86 common frames omitted
  136. Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  137.  
  138. The last packet successfully received from the server was 20,519 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
  139. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  140. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  141. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  142. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  143. at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  144. at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121)
  145. at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3603)
  146. at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3492)
  147. at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4043)
  148. at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
  149. at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
  150. at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2809)
  151. at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2758)
  152. at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1612)
  153. at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3930)
  154. ... 118 common frames omitted
  155. Caused by: java.net.SocketException: Software caused connection abort: recv failed
  156. at java.net.SocketInputStream.socketRead0(Native Method)
  157. at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
  158. at java.net.SocketInputStream.read(SocketInputStream.java:170)
  159. at java.net.SocketInputStream.read(SocketInputStream.java:141)
  160. at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
  161. at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
  162. at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
  163. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3049)
  164. at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3503)
  165. ... 126 common frames omitted

解决:
  在mysql中输入以下,查看wait_timeout

  show global variables like 'wait_timeout';

  如果在wait_timeout秒期间内,数据库连接(java.sql.Connection)一直处于等待状态,mysql5就将该连接关闭。这时,你的Java应用的连接池仍然合法地持有该连接的引用。当用该连接来进行数据库操作时,就碰到上述错误。

  修改my.ini文件中(没有则添加如下):

  wait_timeout=31536000

The last packet successfully received from the server was 20,519 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.的更多相关文章

  1. The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

    今天项目中报了如下错误 The last packet sent successfully to the server was 0 milliseconds ago. The driver has n ...

  2. The last packet successfully received from the server was 2,926,157 milliseconds ago. The last packet sent successfully to the server was 2,926,158 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 解决办法

    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rec ...

  3. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 78,050,512 milliseconds ago.

    今天访问已经架上服务器的网站,报错: Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet s ...

  4. Communications link failure;;The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure::The ...

  5. Communications link failure,The last packet successfully received from the server was *** millisecon

    使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...

  6. Mysql 的异常:The last packet successfully received from the server was 90 milliseconds ago. The last packet sent successfully to the server was 43,603,303 milliseconds ago. is longer than the server con

    调试一个程序, 调试到一半, 下班回家, 程序卡在了某一行, 第二天早上回来一看, 发现了异常: Wed Sep :: GMT+: WARN: Establishing SSL connection ...

  7. The last packet successfully received from the server was 1,480 milliseconds ago.

    场景:一个上传接口,需要上传几十M的文件,文件中包含10几W的数据,然后对10+W的数据进行同步批量插入,每次批量插入1W.最后返回结果. 项目上线一段时间后,上传接口出现问题,数据库用的MySQL5 ...

  8. 【异常】ser class threw exception: java.sql.SQLException: The last packet successfully received from the server was 39,444 milliseconds ago. The last

    1 详细异常 ser class threw exception: java.sql.SQLException: The last packet successfully received from ...

  9. mysql重连,连接丢失:The last packet successfully received from the server--转载

    原文地址:http://nkcoder.github.io/blog/20140712/mysql-reconnect-packet-lost/ 1.1 错误信息: Caused by: com.my ...

随机推荐

  1. Compile SQLite3 from individual files

    下载非Amalgamation SQLite3源码 安装tcl, apt-get instal tcl 解压 mkdir build cd build ../configure make #make ...

  2. dwz Esc关闭dialog 窗口

    document.onkeydown = function(e){ // alert(1) var keycode = ""; if(navigator.appName == &q ...

  3. Java全栈程序员之02:Ubuntu下Java环境安装、配置、测试

    在上文讲完之后,我们手里的ubuntu只能算是一个上网机,什么也干不了,本篇我们将折腾它为开发机. 这里,我们这里假定你对linux体系是初级选手,所以本篇会讲的啰嗦一点,高手就出门左转吧. 1.安装 ...

  4. JAVA递归、非递归遍历二叉树(转)

    原文链接: JAVA递归.非递归遍历二叉树 import java.util.Stack; import java.util.HashMap; public class BinTree { priva ...

  5. ReactNative: 搭建ReactNative开发环境

    搭建ReactNative开发环境 不废话,具体步骤如下: 一.安装需要的软件 1.Homebrew Homebrew, Mac系统的包管理器,用于安装NodeJS和一些其他必需的工具软件. /usr ...

  6. centos7 使用rsync 实现文件同步

    一.服务端(192.168.8.81): 安装软件: yum -y install rsync 创建需同步的目录: mkdir -p /home/root/rsync 编辑配置文件:vim /etc/ ...

  7. 如何用 async 控制流程

    来自: http://larry850806.github.io/2016/05/31/async/ [Javascript] 如何用 async 控制流程 (一) 31 May 2016 async ...

  8. Android性能优化-App后台优化

    原文链接 Background Optimizations 前言 后台进程是内存和电池敏感的.一个隐式的broadcast可能会启动很多监听它的后台进程,即使这些进程可能做得工作不多.这可能丢设备性能 ...

  9. ARP协议具体解释之Gratuitous ARP(免费ARP)

    ARP协议具体解释之Gratuitous ARP(免费ARP) Gratuitous ARP(免费ARP) Gratuitous ARP也称为免费ARP.无故ARP.Gratuitous ARP不同于 ...

  10. ui-router 1.0 002 未登录跳转到login

    ui-router transitionhooks 统一控制路由跳转, 前台控制如果没有登录就跳转到登录页面, 当然也可以在后台控制, 如果没有登录就返回对应的错误码, 然后在response中直接跳 ...