The following error occurs when I connect to MySQL through spring today:
09:35:42, 966 [qtp1599775880-15] warn [COM. XXX. muce. webapp. Controller. queryjobcontroller]-exception:
Org. springframework. dao. recoverabledataaccessexception: preparedstatementcallback; SQL [select ID, user, hql, output, priority, status, s_time, r_time, c_time, progress, reason from queryjob where (status =? And user =? )]; The last packet successfully received
From the server was 47,751,581 milliseconds ago. the last packet sent successfully to the server was 47,751,582 milliseconds ago. is longer than the server configured value of 'wait _ timeout '. you shoshould 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 .; nested exception is com. mySQL. JDBC. exceptions. jdbc4.communicationsexception:
The last packet successfully received from the server was 47,751,581 milliseconds ago. the last packet sent successfully to the server was 47,751,582 milliseconds ago. is longer than the server configured value of 'wait _ timeout '. you shoshould 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. springframework. JDBC. Support. sqlexceptionsubclasstranslator. dotranslate (sqlexceptionsubclasstranslator. Java: 98)
At org. springframework. JDBC. Support. abstractfallbacksqlexceptiontranslator. Translate (abstractfallbacksqlexceptiontranslator. Java: 72)
At org. springframework. JDBC. Support. abstractfallbacksqlexceptiontranslator. Translate (abstractfallbacksqlexceptiontranslator. Java: 80)
At org.springframework.jdbc.core.jdbctemplate.exe cute (jdbctemplate. Java: 602)
At org. springframework. JDBC. Core. jdbctemplate. Query (jdbctemplate. Java: 636)
At org. springframework. JDBC. Core. jdbctemplate. Query (jdbctemplate. Java: 665)
At org. springframework. JDBC. Core. jdbctemplate. Query (jdbctemplate. Java: 673)
At org. springframework. JDBC. Core. jdbctemplate. Query (jdbctemplate. Java: 713)
At com. XXX. muce. Dao. impl. queryjobdaoimpl. Gets (queryjobdaoimpl. Java: 79)
At com. XXX. muce. Service. impl. queryjobserviceimpl. createjob (queryjobserviceimpl. Java: 46)
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: 601)
At org. springframework. AOP. Support. aoputils. invokejoinpointusingreflection (aoputils. Java: 318)
At org. springframework. AOP. Framework. reflectivemethodinvocation. invokejoinpoint (reflectivemethodinvocation. Java: 183)
At org. springframework. AOP. Framework. reflectivemethodinvocation. Proceed (reflectivemethodinvocation. Java: 150)
At org. springframework. transaction. Interceptor. transactioninterceptor. Invoke (transactioninterceptor. Java: 110)
At org. springframework. AOP. Framework. reflectivemethodinvocation. Proceed (reflectivemethodinvocation. Java: 172)
At org. springframework. AOP. Framework. jdkdynamicaopproxy. Invoke (jdkdynamicaopproxy. Java: 202)
At $ proxy44.createjob (unknown source)
At com. XXX. muce. webapp. Controller. queryjobcontroller. submitjob (queryjobcontroller. Java: 104)
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: 601)
At org. springframework. Web. method. Support. invocablehandlermethod. Invoke (invocablehandlermethod. Java: 213)
At org. springframework. Web. method. Support. invocablehandlermethod. invokeforrequest (invocablehandlermethod. Java: 126)
At org. springframework. Web. servlet. MVC. method. annotation. servletinvocablehandlermethod. invokeandhandle (servletinvocablehandlermethod. Java: 96)
At org. springframework. Web. servlet. MVC. method. annotation. requestmappinghandleradapter. invokehandlermethod (requestmappinghandleradapter. Java: 617)
At org. springframework. Web. servlet. MVC. method. annotation. requestmappinghandleradapter. handleinternal (requestmappinghandleradapter. Java: 578)
At org. springframework. Web. servlet. MVC. method. abstracthandlermethodadapter. Handle (abstracthandlermethodadapter. Java: 80)
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. doput (frameworkservlet. Java: 800)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 758)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 848)
At org. Eclipse. Jetty. servlet. servletholder. Handle (servletholder. Java: 594)
At org. Eclipse. Jetty. servlet. servlethandler $ cachedchain. dofilter (servlethandler. Java: 1365)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 311)
At org. springframework. Security. Web. Access. Intercept. filtersecurityinterceptor. Invoke (filtersecurityinterceptor. Java: 116)
At org. springframework. Security. Web. Access. Intercept. filtersecurityinterceptor. dofilter (filtersecurityinterceptor. Java: 83)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Access. exceptiontranslationfilter. dofilter (exceptiontranslationfilter. Java: 113)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. session. sessionmanagementfilter. dofilter (sessionmanagementfilter. Java: 101)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Authentication. anonymousauthenticationfilter. dofilter (anonymousauthenticationfilter. Java: 113)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. servletapi. securitycontextholderawarerequestfilter. dofilter (securitycontextholderawarerequestfilter. Java: 54)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. savedrequest. requestcacheawarefilter. dofilter (requestcacheawarefilter. Java: 45)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Authentication. www. basicauthenticationfilter. dofilter (basicauthenticationfilter. Java: 150)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Authentication. UI. defaultloginpagegeneratingfilter. dofilter (defalogloginpagegeneratingfilter. Java: 91)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Authentication. abstractauthenticationprocessingfilter. dofilter (abstractauthenticationprocessingfilter. Java: 182)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Authentication. abstractauthenticationprocessingfilter. dofilter (abstractauthenticationprocessingfilter. Java: 182)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Authentication. logout. logoutfilter. dofilter (logoutfilter. Java: 105)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. Context. securitycontextpersistencefilter. dofilter (securitycontextpersistencefilter. Java: 87)
At org. springframework. Security. Web. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. Java: 323)
At org. springframework. Security. Web. filterchainproxy. dofilter (filterchainproxy. Java: 173)
At org. springframework. Web. Filter. delegatingfilterproxy. invokedelegate (delegatingfilterproxy. Java: 346)
At org. springframework. Web. Filter. delegatingfilterproxy. dofilter (delegatingfilterproxy. Java: 259)
At org. Eclipse. Jetty. servlet. servlethandler $ cachedchain. dofilter (servlethandler. Java: 1336)
At org. springframework. Web. Filter. characterencodingfilter. dofilterinternal (characterencodingfilter. Java: 88)
At org. springframework. Web. Filter. onceperrequestfilter. dofilter (onceperrequestfilter. Java: 76)
At org. Eclipse. Jetty. servlet. servlethandler $ cachedchain. dofilter (servlethandler. Java: 1336)
At org. Eclipse. Jetty. servlet. servlethandler. dohandle (servlethandler. Java: 483)
At org. Eclipse. Jetty. server. handler. scopedhandler. Handle (scopedhandler. Java: 119)
At org. Eclipse. Jetty. Security. securityhandler. Handle (securityhandler. Java: 524)
At org. Eclipse. Jetty. server. session. sessionhandler. dohandle (sessionhandler. Java: 233)
At org. Eclipse. Jetty. server. handler. contexthandler. dohandle (contexthandler. Java: 1065)
At org. Eclipse. Jetty. servlet. servlethandler. doscope (servlethandler. Java: 412)
At org. Eclipse. Jetty. server. session. sessionhandler. doscope (sessionhandler. Java: 192)
At org. Eclipse. Jetty. server. handler. contexthandler. doscope (contexthandler. Java: 999)
At org. Eclipse. Jetty. server. handler. scopedhandler. Handle (scopedhandler. Java: 117)
At org. Eclipse. Jetty. server. handler. contexthandlercollection. Handle (contexthandlercollection. Java: 250)
At org. Eclipse. Jetty. server. handler. handlercollection. Handle (handlercollection. Java: 149)
At org. Eclipse. Jetty. server. handler. handlerwrapper. Handle (handlerwrapper. Java: 111)
At org. Eclipse. Jetty. server. server. Handle (servers. Java: 351)
At org. Eclipse. Jetty. server. abstracthttpconnection. handlerequest (abstracthttpconnection. Java: 454)
At org. Eclipse. Jetty. server. abstracthttpconnection. headercomplete (abstracthttpconnection. Java: 890)
At org. Eclipse. Jetty. server. abstracthttpconnection $ requesthandler. headercomplete (abstracthttpconnection. Java: 944)
At org. Eclipse. Jetty. http. httpparser. parsenext (httpparser. Java: 634)
At org. Eclipse. Jetty. http. httpparser. parseavailable (httpparser. Java: 230)
At org. Eclipse. Jetty. server. asynchttpconnection. Handle (asynchttpconnection. Java: 76)
At org. Eclipse. Jetty. Io. NiO. selectchannelendpoint. Handle (selectchannelendpoint. Java: 609)
At org. Eclipse. Jetty. Io. NiO. selectchannelendpoint $ 1.run( selectchannelendpoint. Java: 45)
At org. Eclipse. Jetty. util. thread. queuedthreadpool. runjob (queuedthreadpool. Java: 599)
At org. Eclipse. Jetty. util. thread. queuedthreadpool $ 3.run( queuedthreadpool. Java: 534)
At java. Lang. thread. Run (thread. Java: 722)
Caused by: COM. mySQL. JDBC. exceptions. jdbc4.communicationsexception: The last packet successfully encoded ed from the server was 47,751,581 milliseconds ago. the last packet sent successfully to the server was 47,751,582 milliseconds ago. is longer than the server
Configured value of 'wait _ timeout '. you shoshould 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)
At sun. Reflect. nativeconstruct%cessorimpl. newinstance (nativeconstruct%cessorimpl. Java: 57)
At sun. Reflect. delegatingconstruct%cessorimpl. newinstance (delegatingconstruct%cessorimpl. Java: 45)
At java. Lang. Reflect. constructor. newinstance (constructor. Java: 525)
At com. MySQL. JDBC. util. handlenewinstance (util. Java: 411)
At com. MySQL. JDBC. sqlerror. createcommunicationsexception (sqlerror. Java: 1116)
At com. MySQL. JDBC. mysqlio. Send (mysqlio. Java: 3352)
At com. MySQL. JDBC. mysqlio. sendcommand (mysqlio. Java: 1971)
At com. MySQL. JDBC. mysqlio. sqlquerydirect (mysqlio. Java: 2151)
At com.mysql.jdbc.connectionimpl.exe csql (connectionimpl. Java: 2625)
At com.mysql.jdbc.preparedstatement.exe cuteinternal (preparedstatement. Java: 2119)
At com.mysql.jdbc.preparedstatement.exe cutequery (preparedstatement. Java: 2281)
At org.apache.commons.dbcp.delegatingpreparedstatement.exe cutequery (delegatingpreparedstatement. Java: 96)
At org.apache.commons.dbcp.delegatingpreparedstatement.exe cutequery (delegatingpreparedstatement. Java: 96)
At org.apache.commons.dbcp.delegatingpreparedstatement.exe cutequery (delegatingpreparedstatement. Java: 96)
At org. springframework. JDBC. Core. jdbctemplate $1. doinpreparedstatement (jdbctemplate. Java: 643)
At org.springframework.jdbc.core.jdbctemplate.exe cute (jdbctemplate. Java: 586)
... 93 more
Caused by: java.net. socketexception: disconnected Pipe
At java.net. socketoutputstream. socketwrite0 (native method)
At java.net. socketoutputstream. socketwrite (socketoutputstream. Java: 109)
At java.net. socketoutputstream. Write (socketoutputstream. Java: 153)
At java. Io. bufferedoutputstream. flushbuffer (bufferedoutputstream. Java: 82)
At java. Io. bufferedoutputstream. Flush (bufferedoutputstream. Java: 140)
At com. MySQL. JDBC. mysqlio. Send (mysqlio. Java: 3333)
... 103 more
Yesterday was normal. This morning there was a problem. I searched the internet and it seems that the connection in the MySQL connection pool has expired. I tried several methods and finally solved the problem by adding autoreconnectforpools = true to the JDBC connection string of MySQL.
#####################
Reference link:
Http://blog.csdn.net/ly5156/article/details/6717520
#############
Today I encountered a similar problem. The error message is similar. I added the following two parameters to the DHCP part of the configuration file and then restarted the service to solve the problem.
Testonborrow = "true"
Validationquery = "select 1 ″
Reference link:
Http://tomaszdziurko.pl/2010/06/solving-com-mysql-jdbc-exceptions-jdbc4-communicationsexception-in-spring-jdbc-based-application/