2

*My application is running on tomcat 6 along with hibernate3 and mysql version is 5.x,

i am getting an exception of JDBC connection lost after wait_timeout in mysql, all my jsp pages will be pass through the Filters

I am using tomcat clustering with apache in front. Running my crons separately using quartz database.*

Below is my exception stacktrace...... Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION ** 

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2637)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3176)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1153)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1266)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
    at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:389)
    at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:310)
    at org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:177)
    at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1175)
    at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
    at java.lang.Thread.run(Thread.java:662)


** END NESTED EXCEPTION **
Krishna
  • 21
  • 1
  • Sounds like your database or the network went down. You have a complex networking setup (apache-->tomcat cluster-->mysql) -- have you looked at the logs on the various servers to determine where the failure is? Nobody here is going to be able to help you without a LOT more information. And BTW, this probably belongs on [sf] as it's not a programming question. – Jim Garrison Feb 20 '12 at 06:54
  • i am confused whether to c3p0 or not, if i am using c3p0 my tomcat without cluster itself is getting hanged ( not responding)....if i remove c3p0 i am getting broken pipe exception.. – Krishna Feb 20 '12 at 07:03
  • Again, we can't help you unless you show the pertinent log entries from the various servers. – Jim Garrison Feb 20 '12 at 07:08
  • No, that's the wrong log. We know that error is happening, what we need to know is what's happening on the SQL server side. Please delete the comment with the stacktrace and in future EDIT your post and add the pertinent information there. – Jim Garrison Feb 20 '12 at 07:16
  • Thanks for your time!!! i have changed couple of things in mysql side also like.. 1) added max_connections=100 2) added wait_timeout=120 3) added interactive_timeout=120 and using the default my.cnf of mysql version 5.0.45 finally i am running all these things on CentOS vm – Krishna Feb 20 '12 at 07:21

0 Answers0