>
> DBCP documentation says you need to validateConnection(connection) before you 
> close it 


No you don't.  Just close the connection DBCP returned when you called
DataSource.getConnection()

--David

Martin Gainty wrote:
> DBCP documentation says you need to validateConnection(connection) before you 
> close it e.g.http://wiki.apache.org/commons/DBCPMartin 
> ______________________________________________ Disclaimer and confidentiality 
> note Everything in this e-mail and any attachments relates to the official 
> business of Sender. This transmission is of a confidential nature and Sender 
> does not endorse distribution to any party other than intended recipient. 
> Sender does not necessarily endorse content contained within this 
> transmission. > Date: Sun, 28 Dec 2008 12:25:05 -0800> From: 
> gbatt...@alice.it> To: users@tomcat.apache.org> Subject: 
> java.sql.SQLException: Already closed..strange!> > > Hello guys,> I've a 
> strange problem with my jsp application.> I use Tomcat 6.0.18.> I use 
> connection pool with dbcp and this is context.xml of my application> > > 
> <?xml version="1.0" encoding="UTF-8"?>> <!-- Connessione al db sul server 
> jsys-->> <Context path="/xxx" docBase="xxx" debug="5" reloadable="true"> 
> crossContext="true">>> <Resource auth="Container" 
> driverClassName="com.mysql.jdbc.Driver"> maxActive="200" maxIdle="200" 
> maxWait="200"> name="jdbc/x_db1" password="pwd" type="javax.sql.DataSource"> 
> url="jdbc:mysql://xxx.x.xxx.x:3308/x_db1"> username="usrn" 
> removeAbandoned="true" removeAbandonedTimeout="60"> logAbandoned="true"/>> 
> </Context>> > > When I run application it works correctly.> Sometimes (I'm 
> not able to understand why) I've got, running application,> this error:> > > 
> HTTP Status 500 - > > 
> -------------------------------------------------------------------------------->
>  > type Exception report> > message > > description The server encountered an 
> internal error () that prevented it> from fulfilling this request.> > 
> exception > > org.apache.jasper.JasperException: 
> javax.servlet.ServletException:> java.sql.SQLException: Already closed.> > 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)>
>  > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)>
>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)> 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)> > > root cause 
> > > javax.servlet.ServletException: java.sql.SQLException: Already closed.> > 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)>
>  > 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)>
>  org.apache.jsp.index_jsp._jspService(index_jsp.java:256)> 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)>
>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)> 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)> > > root cause 
> > > java.sql.SQLException: Already closed.> > 
> org.apache.tomcat.dbcp.dbcp.PoolableConnection.close(PoolableConnection.java:84)>
>  > 
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)>
>  org.apache.jsp.index_jsp._jspService(index_jsp.java:155)> 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)>
>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)> 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)> 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)> > > note The 
> full stack trace of the root cause is available in the Apache> Tomcat/6.0.16 
> logs.> > > 
> -------------------------------------------------------------------------------->
>  > Apache Tomcat/6.0.16> > > If I add index.jsp to url (for example 
> www.myapps.it/index.jsp) it works> correctly, not showing previous error.> > 
> Another way to solve problem is to restart tomcat and it works correctly for> 
> many days...> It's not clear to me...could someone help me to understand?> Is 
> there some error with my connection pool?> > Thanks,> Regards > -- > View 
> this message in context: 
> http://www.nabble.com/java.sql.SQLException%3A-Already-closed..strange%21-tp21195800p21195800.html>
>  Sent from the Tomcat - User mailing list archive at Nabble.com.> > > 
> ---------------------------------------------------------------------> To 
> unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org> For additional 
> commands, e-mail: users-h...@tomcat.apache.org> 
> _________________________________________________________________
> Send e-mail faster without improving your typing skills.
> http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
>   


-- 
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to