Bug #38561 com.mysql.jdbc.CommunicationsException: Communications link failure due to under
Submitted: 5 Aug 2008 9:10 Modified: 13 Aug 2008 11:06
Reporter: sreejith surendran Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:MySQL 5.0 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: java.net.SocketException

[5 Aug 2008 9:10] sreejith surendran
Description:
Hii.

I  have an exception occured in my JDBC program when i am connected to the domain server. I can run this in local system using Tomcat server, but when i am trying to connect it with Domain server its seems to be a socket exception in the connecting bean.. what are the reasons for sockect exception ..?? how we can manage it..? i think some one help me with a goos solution..

This is the code 

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.ConnectException: Connection timed out: connect STACKTRACE: java.net.SocketException: java.net.ConnectException: Connection timed out: connect at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:151) at com.mysql.jdbc.MysqlIO.(MysqlIO.java:280) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699) at com.mysql.jdbc.Connection.(Connection.java:405) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.DBHelper1.getConnection(DBHelper1.java:18) at org.apache.jsp.spa_005fproducts_jsp._jspService(spa_005fproducts_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:619) ** END NESTED EXCEPTION ** 

How to repeat:
Its repeating when its connecting to the domain server
[5 Aug 2008 11:53] Miguel Solorzano
Changing Category field.
[13 Aug 2008 11:06] Tonci Grgin
Hi Sreejith and thanks for your report.

You don't really expect me to answer this:
>> what are the reasons for sockect exception ..?? how we can manage it..? i think some one help me with a goos solution..<<
right?

All I can tell you that I can not work on this report unless you have repeatable test case, otherwise you'll need support contract.

Please read c/J manual carefully (especially on "KeepAlive" and "SocketTimeouts"), set up your MySQL server/network properly and do search BugDB for solutions posted by others.

I must close this report now as it is free support request.