Are you getting the connection anew after restarting the server?  It looks
like you have this case:

T0      Connection x = Datasource.getConnection()
T1      Do some stuff
T2      Shutdown / restart MySQL
T3      x.prepareStatement() or other stuff
... FAIL

The connection pool will only renew the connection on the
Datasource.getConnection() (the validation query, SELECT 1, will only run on
getConnection() -- in your case with test on borrow)


Tim


> -----Original Message-----
> From: Seetha Rao [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 20, 2006 2:35 PM
> To: Tomcat Users List
> Subject: Tomcat fails to refresh connections when mySQL server on linux is
> shutdown and restarted
> 
> Hi,
> 
> We are doing a test where mySQL server goes down when user is accessing a
> webapplication.
> We have setup tomcat with the required parameters for DBCP to handle such
> a
> case.
> It works fine in a set up where Tomcat and mySQL are on the same windows
> machine.
> But in a setup where Tomcat is on Windows machine connecting to mySQL
> running on a linux machine, it does not work.
> 
> Here are the versions:
> 
> Tomcat 5.0
> mySQL 4.1
> Linux 2.6 Fedora
> 
> We have configured Tomcat with the following in our webapp xml file (I'm
> pasting a part of it)
> 
> <parameter>
> <name>validationQuery</name>
> <value>select 1</value>
> </parameter>
> 
> <parameter>
> <name>testOnBorrow</name>
> <value>true</value>
> </parameter>
> 
> <parameter>
> <name>testWhileIdle</name>
> <value>true</value>
> </parameter>
> 
> <parameter>
> <name>timeBetweenEvictionRunsMillis</name>
> <value>10000</value>
> </parameter>
> 
> <parameter>
> <name>minEvictableIdleTimeMillis</name>
> <value>60000</value>
> </parameter>
> 
> <parameter>
> <name>url</name>
> <value>jdbc:mysql://190.162.50.20:3306/xyz_office?autoReconnect=true</valu
> e>
> </parameter>
> 
> Here is the test we are doing;
> 1. Enter the web application, do something which accesses the database
> 2. Stop mysql server and restart on linux
> 3. Try to do something in the web application
> 4. Tomcat gives the following exception
> 
> stdout.log
> 
> java.sql.SQLException: No operations allowed after statement closed.
> This comes many many times, basically an overflow.
> 
> In the browser:
> 
> javax.servlet.ServletException: Servlet execution threw an exception
> 
> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:6
> 70
> )
>       org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.ja
> va:637)
>       org.apache.jsp.index_jsp._jspService(index_jsp.java:46)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
> :3
> 24)
>       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
> 292)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
> 10
> 69)
> 
> org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProc
> es
> sor.java:455)
> 
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:27
> 9)
>       org.apache.struts.action.ActionServlet.process(ActionServlet.java:14
> 82)
>       org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525
> )
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> This comes many many times, basically an overflow.
> 
> root cause
> 
> java.lang.StackOverflowError
> 
> org.apache.coyote.tomcat5.CoyoteRequest.getAttribute(CoyoteRequest.java:90
> 9)
> 
> org.apache.coyote.tomcat5.CoyoteRequestFacade.getAttribute(CoyoteRequestFa
> ca
> de.java:214)
> 
> Could anyone please give us some hints?
> 
> Thanks
> Seetha
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to