Nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link FAI

Source: Internet
Author: User
Tags aop

This evening a financial subsystem on-line, after the deployment is completed, test feedback program will be convulsions, a while normal, a moment abnormal, reported the following error:

Nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link FAI

By looking for data, may be wait_timeout set too small caused, try to increase the value of Wait_timeout, the system returned to normal.

The change process is as follows:

# #查看MySQL配置[Email protected]:mysql.sock [finance]>show global variables like ' wait_timeout ';+---------------+-------+| variable_name | Value |+---------------+-------+| wait_timeout |+---------------+-------+1 row in Set (0.01 sec)[Email protected]:mysql.sock [finance]>show global variables like '%interactive_timeout% ';+---------------------+-------+| variable_name | Value |+---------------------+-------+| interactive_timeout | 28800 |+---------------------+-------+# #先修改全局的值为300, the original value will be restored after reboot[Email protected]:mysql.sock [Finance]>set global wait_timeout=300;
[Email protected]:mysql.sock [finance]>show global variables like ' wait_timeout ';+--------------------------+----------+| variable_name | Value |+--------------------------+----------+| wait_timeout |+--------------------------+----------+# #修改my. CNF to ensure that MySQL is still in effect after restart[MySQLd] wait_timeout=300# # Wait_timeout ExtensionsThe default "Wait_timeout" for MySQL server is 28,800 seconds, or 8 hours, which means that if a connection is idle for more than 8 hours, MySQL will automatically disconnect the connection and the connection pool considers the connection to be valid (because the connection is not validated). When the application uses the connection, it causes the error above.
Workaround:Modify MY.CNF:[MySQLd] wait_timeout=31536000interactive_timeout=31536000 Modify the expiration time to 1 years. The Error log logs are as follows:
The last packet successfully received from the server was 9,369 milliseconds ago. The last packet sent successfully to the server was 0milliseconds ago.; SQL []; Communications link Failure The last packet successfully received from the server was9,369 milliseconds ago. The last packet sent successfully to the server was 0milliseconds ago.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications Link failure The last packet successfully received from the server was9,369 milliseconds ago. The last packet sent successfully to the server was 0milliseconds ago.at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate ( Sqlexceptionsubclasstranslator.java:98) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( Abstractfallbacksqlexceptiontranslator.java:73) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( Abstractfallbacksqlexceptiontranslator.java:81) at Org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible ( Mybatisexceptiontranslator.java:73) at Org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke (Sqlsessiontemplate.java:371) at Com.sun.proxy. $Proxy 11.selectList (Unknown Source) at Org.mybatis.spring.SqlSessionTemplate.selectList ( Sqlsessiontemplate.java:198) at Org.apache.ibatis.binding.MapperMethod.executeForMany (Mappermethod.java:119) at Org.apache.ibatis.binding.MapperMethod.execute (Mappermethod.java:63) at Org.apache.ibatis.binding.MapperProxy.invoke (Mapperproxy.java:52) at Com.sun.proxy. $Proxy 12.searchRules (Unknown Source) at Com.tianlian.order.server.finance.service.impl.poundage.WPOSPoundageServiceImpl.searchRules ( Wpospoundageserviceimpl.java:55) at com.tianlian.order.server.finance.service.impl.poundage.wpospoundageserviceimpl$ $FastClassBySpringCGLIB $ $AEC 2fff5.invoke (<generated>) at Org.springframework.cglib.proxy.MethodProxy.invoke (Methodproxy.java:204) at Org.springframework.aop.framework.cglibaopproxy$cglibmethodinvocation.invokejoinpoint ( Cglibaopproxy.java:720) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 157) at Com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke (Druidstatinterceptor.java:72) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 179) at Org.springframework.aop.framework.cglibaopproxy$dynamicadvisedinterceptor.intercept (CglibAopProxy.java: 655) at com.tianlian.order.server.finance.service.impl.poundage.wpospoundageserviceimpl$ $EnhancerBySpringCGLIB $ $db 4e378e.searchrules (<generated>) at Com.alibaba.dubbo.common.bytecode.Wrapper0.invokeMethod (Wrapper0.java) at com.alibaba.dubbo.rpc.proxy.javassist.javassistproxyfactory$1.doInvoke (javassistproxyfactory.java:46) at Com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke (Abstractproxyinvoker.java:72) at Com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke (Invokerwrapper.java:53) at Com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke (Exceptionfilter.java:64) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke (Timeoutfilter.java:42) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.monitor.support.MonitorFilter.invoke (Monitorfilter.java:75) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke (Tracefilter.java:78) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.rpc.filter.ContextFilter.invoke (Contextfilter.java:60) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.rpc.filter.GenericFilter.invoke (Genericfilter.java:112) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke (Classloaderfilter.java:38) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at Com.alibaba.dubbo.rpc.filter.EchoFilter.invoke (Echofilter.java:38) at com.alibaba.dubbo.rpc.protocol.protocolfilterwrapper$1.invoke (protocolfilterwrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.dubboprotocol$1.reply (dubboprotocol.java:108) at Com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest ( Headerexchangehandler.java:84) at Com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received ( Headerexchangehandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received (Decodehandler.java:52) at Com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run (Channeleventrunnable.java: 82) 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:722) caused by:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure
Error Log

Nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link FAI

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.