Bug #1257 java.sql.SQLException: Communication failure during handshake
Submitted: 11 Sep 2003 20:43 Modified: 28 Mar 2014 12:00
Reporter: Mike Bushman Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:3.23 OS:Linux (Linux)
Assigned to: Alexander Soklakov CPU Architecture:Any

[11 Sep 2003 20:43] Mike Bushman
Description:
If I leave my web-application running for over two weeks, I will get the following error:
java.sql.SQLException: Communication failure during handshake. Is there a server running on [server]:3306?

I have only found a couple of other reports similar to this as I searched on google for mysql errors.  One person noted (last april) that they thought they fixed it by upgrading the connector j driver.

I am running a j2ee web application on apache/tomcat and using mysql as my database.  I have verified that I don't have any connection leaks.  The following is the full stack trace:

java.sql.SQLException: Communication failure during handshake. Is there a server running on [server]:3306?
        at com.mysql.jdbc.MysqlIO.init(Unknown Source)
        at com.mysql.jdbc.Connection.connectionInit(Unknown Source)
        at com.mysql.jdbc.jdbc2.Connection.connectionInit(Unknown Source)
        at com.mysql.jdbc.Driver.connect(Unknown Source)
        at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(Unknown Source)
        at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(Unknown Source)
        at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(Unknown Source)
        at com.simplysharp.db.Manager.open(Unknown Source)
        at com.simplysharp.db.Manager.loadVector(Unknown Source)
        at com.simplysharp.db.Manager.loadVector(Unknown Source)
        at com.simplysharp.db.BookManager.loadVector(Unknown Source)
        at com.simplysharp.db.Cache.loadBooks(Unknown Source)
        at com.simplysharp.salon.plugin.DBPlugIn.loadCache(Unknown Source)
        at com.simplysharp.salon.plugin.DBPlugIn.init(Unknown Source)
        at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
        at javax.servlet.GenericServlet.init(GenericServlet.java:256)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:924)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:813)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3341)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3534)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
        at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:257)
        at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:502)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:410)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
        at org.apache.catalina.core.StandardService.start(StandardService.java:497)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:510)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

How to repeat:
This seems to happen when I haven't restarted the web application for 2+ weeks.  The other user I found with a similar issue, that seemed to be related to time:  http://www.geocrawler.com/archives/3/193/2002/4/0/8536949/
[12 Sep 2003 11:19] Mark Matthews
From the stacktrace, it appears you are using an old version of Connector/J. Please upgrade to Connector/J 3.0.8 (or a nightly snapshot build of the 3.0 series from http://mmmysql.sourceforge.net/snapshots/stable/) and see if that solves your problem (there are quite a few stability bugfixes in the 3.0 series).
[19 Nov 2003 11:33] Mark Matthews
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
[28 Mar 2014 12:00] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.