File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communications link failure due to underlying exception

 
Milind Talele
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting this exception frequently on console. I have increase Mysql time out period to 8 Hr also but it doesn't work. After restart tomcat it work for some time
again this exceptions come on console.
I am using Tomcat 6 with MySQL, and Torque

===============================================================================
[11/21/10 12:02 AM WARNING] TorqueException while getting the new Connection org.apache.torque.TorqueException: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1963)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2375)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2874)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3243)
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5371)
at
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.setAutoCommit(ConnectionImpl.java:326)
at org.apache.commons.dbcp.datasources.SharedPoolDataSource.setupDefaults(SharedPoolDataSource.java:227)
at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:692)
at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:653)
at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:912)
at org.apache.torque.Torque.getConnection(Torque.java:314)
at org.apache.torque.util.Transaction.beginOptional(Transaction.java:108)
at com.company.framework.model.util.TorqueUtility.getNewConnection(TorqueUtility.java:712)
at com.company.cs.allocation.job.alert.WSAlertSYProfileLoader.loadProfile(WSAlertSYProfileLoader.java:161)
at com.company.framework.alert.JobSYProcessing.csJobExecute(JobSYProcessing.java:70)
at
com.company.framework.jobutility.csJobThread.run(csJobThread.java:137)


** END NESTED EXCEPTION **

Last packet sent to the server was 0 ms ago. -> com.company.framework.model.util.TorqueUtility.getNewConnection():718
==================================================================================

After this exception application stop working and on every click it show this exception on console.


Any one have solution on this? please reply.

Thanks in advance.

 
Jan Cumps
Bartender
Posts: 2577
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Milind.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33696
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Milind,
Welcome to CodeRanch!

There are a few timeouts you may have to look at. One is the database timeout which you looked at. There's also a transaction timeout set on the application server. And if your database is on the network, you may have a firewall timeout.

A question though - do you have a giant database operation or is this just happening on small operations from time to time? If the later, you should check your connection pool settings. The min size might be too high. Another approach is to try to get the connection a second time on failure.
 
Milind Talele
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1. Do you means transaction setting in Tomcat? Where it is ?
2. I am using below setting in "torque.properties". maxWait = 2000.
3. When I got exception I tried to get new connection which also rise same exception means torque it is not allowing to give new connection itself.
4. I think this is not a code level issue. May be I am missing some setting on MySQL/ Tomcat side.

== torque.properties ==
torque.applicationRoot = .
torque.database.default=csa
torque.database.csa.adapter=mysql
torque.dsfactory.csa.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.csa.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.csa.connection.url = jdbc:mysql://localhost:3306/Matrix?autoReconnect=true&zeroDateTimeBehavior=convertToNull
torque.dsfactory.csa.connection.user = root
torque.dsfactory.csa.connection.password = root
torque.dsfactory.csa.pool.maxIdle = 20
torque.dsfactory.csa.pool.maxWait = 2000
torque.idbroker.cleverquantity=true
torque.manager.useCache = true
=============================
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33696
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was thinking you were using a connection pool defined on the Tomcat level. Since you are defining it via Torque, it might not apply. Did you set up a <Resource> in your Tomcat config as described here?
 
Milind Talele
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

By upgrading below

a) dbcp commons library
b) connection pool library
c) mysql j/connector library.

I fixed issue.
 
Milind Talele
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I found solution on http://communications-link-failure.blogspot.com

I tried it and it is working for me.

Thanks
 
Jan Cumps
Bartender
Posts: 2577
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Milind,
what was the solution? Your post about upgrading the libraries, or the steps in that blog?
I am confused because you report that two different solutions fixed that issue
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic