You're probably running into the fact that MYSQL closes connections
which have been open "too long".
Probably if you make the request to the server again, you'll find that
it works because the connection is reopened.
One way to deal with this is to add the following to your context.xml
Resource:
validationQuery="select 1"
This causes a very cheap test query to always be run first; if the
connection has been closed, this gets the failure, and
then a new connection is opened.
--Ken
On Dec 28, 2008, at 3:25 PM, gbattine wrote:
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org