I just saw that you are not using Tomcat's connection pool,
the reason still stands, the socket connection is closed when you try to
execute the query.
if you are using a cached connection, then implement a fail safe or use
Tomcat's connection pool, that already has this functionality
Filip
Filip Hanik - Dev Lists wrote:
yes, either MySQL or something else on the network closed the connection
Caused by: java.net.SocketException: Socket closed
if you are using the connection pool, make sure you have set
testOnBorrow="true"
validationQuery="SELECT 1"
so that it validates each connection for you
Filip
Jean-Pierre Astier wrote:
Hi all,
I've got a problem with jdbc 5.1.5 in tomcat 5.5.17.
I have a servlet who retrieve images from mysql 4.1.22 to put them in
a jsp page.
Here is the tomcat log :
----------------------------------------------------------------------------------------------------------------------------------------------------
com.mysql.jdbc.CommunicationsException: Communications link failure
Last packet sent to the server was 17 ms ago.
at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2873)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2763)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3299)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2537)
at
com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2466)
at
com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383)
at
com.maison.myphototheque.metier.myPhotothequeDAO.getImage(myPhotothequeDAO.java:181)
at
com.maison.myphototheque.metier.myPhotothequeBusinessFacade.getImage(myPhotothequeBusinessFacade.java:45)
at
com.maison.myphototheque.beans.myPhotothequeBusinessDelegate.getImage(myPhotothequeBusinessDelegate.java:42)
at
com.maison.myphototheque.servlets.showImage.service(showImage.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
at
com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
at
com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2329)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2774)
... 29 more
----------------------------------------------------------------------------------------------------
Any ideas ???
Thanks
Jean-Pierre
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]