Mybatis jdbc连接超时解决
来源:互联网 发布:mac设置svn用户名密码 编辑:程序博客网 时间:2024/06/08 05:14
这两天在测试Hive权限控制代码Hamza,发现每天来的时候第一次老是会报出以下错误:
[html] view plain copy
- 2015-03-26 09:40:25.956 ERROR GroupPrivController,119 -
- ### Error querying database. Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,704,088 milliseconds ago. The last packet sent successfully to the server was 57,704,089 milliseconds ago. is 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 the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- ### The error may exist in mybatis/hiveDb.xml
- ### The error may involve com.weibo.hamza.core.dao.DbDao.findByOwnerId
- ### The error occurred while executing a query
- ### Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,704,088 milliseconds ago. The last packet sent successfully to the server was 57,704,089 milliseconds ago. is 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 the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- org.apache.ibatis.exceptions.PersistenceException:
- ### Error querying database. Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,704,088 milliseconds ago. The last packet sent successfully to the server was 57,704,089 milliseconds ago. is 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 the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- ### The error may exist in mybatis/hiveDb.xml
- ### The error may involve com.weibo.hamza.core.dao.DbDao.findByOwnerId
- ### The error occurred while executing a query
- ### Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,704,088 milliseconds ago. The last packet sent successfully to the server was 57,704,089 milliseconds ago. is 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 the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95)
- at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:124)
- at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:90)
- at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)
- at com.sun.proxy.$Proxy13.findByOwnerId(Unknown Source)
- at com.weibo.hamza.core.service.impl.DbServiceImpl.findByOwnerId(DbServiceImpl.java:124)
- at com.weibo.hamza.auth.hessian.AuthServiceImpl.findDbByOwnerId(AuthServiceImpl.java:55)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:606)
- at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
- at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
- at com.sun.proxy.$Proxy4.findDbByOwnerId(Unknown Source)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:606)
- at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:180)
- at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:109)
- at org.springframework.remoting.caucho.HessianExporter.doInvoke(HessianExporter.java:198)
- at org.springframework.remoting.caucho.HessianExporter.invoke(HessianExporter.java:118)
- at org.springframework.remoting.caucho.HessianServiceExporter.handleRequest(HessianServiceExporter.java:66)
- at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
- at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
- at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
- at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
- at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
- at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
- at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
- at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
- at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
- at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
- at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
- at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
- at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
- at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
- at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
- at java.lang.Thread.run(Thread.java:745)
- Caused by: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,704,088 milliseconds ago. The last packet sent successfully to the server was 57,704,089 milliseconds ago. is 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 the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:102)
- at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:135)
- at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:58)
- at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279)
- at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:69)
- at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:56)
- at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
- at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:141)
- at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
- at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
- at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101)
- ... 54 more
- Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,704,088 milliseconds ago. The last packet sent successfully to the server was 57,704,089 milliseconds ago. is 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 the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[html] view plain copy
- <environments default="development">
- <environment id="development">
- <transactionManager type="jdbc"/>
- <dataSource type="POOLED">
- <property name="url" value="${cp.Url}"/>
- <property name="driver" value="${cp.DriverClassName}"/>
- <property name="username" value="${cp.Username}"/>
- <property name="password" value="${cp.Password}"/>
- <property name="poolPingEnabled" value="true"/>
- <property name="poolPingQuery" value="select 1"/>
- <property name="poolPingConnectionsNotUsedFor" value="3600000"/>
- </dataSource>
- </environment>
- </environments>
阅读全文
0 0
- Mybatis jdbc连接超时解决
- jdbc连接超时解决
- 解决JDBC 连接 SQL Azure 超时问题
- JDBC连接超时问题
- JDBC连接超时
- mybatis连接MySQL超时
- myBatis连接超时问题
- jdbc 连接数据库设置超时
- JDBC连接数据库 超时问题
- 解决MySql连接超时
- JDBC连接池连接超时失效问题
- mac ssh 连接超时解决
- 如何解决 Socket 连接超时
- jdbc连接hive超时的问题
- JDBC连接超时,导致数据库操作失败
- mybatis解决jdbc的问题
- 解决Mybatis连接Sql server 出现 Cannot load JDBC driver class 'com.mysql.jdbc.Driver '的问题
- JDBC 超时
- 部分网页打不开,有的浏览器连不上网的解决办法之一
- perlipc中文
- 《剑指offer》问题7 重建二叉树 Java实现
- CodeForces
- 欧拉函数与欧拉定理
- Mybatis jdbc连接超时解决
- Git学习笔记(三) 远程仓库
- java中hashCode()与equals()的绑定联系
- [Linux]--Bootloder启动流程
- 【LeetCode】011 Container With Most Water
- Spring Boot Admin实践
- 微信小程序开发第三弹
- 润乾报表在WEB浏览器中特殊符号传参问题
- 急java 怎么解析两层中括号[[]] 的json格式文件(4)