Hi,
I use the connection pool of tomcat7 and set a connection in a
ThreadLocal. The context is a web application : the threadLocal is
configured when the http request is initialized. The jdbc connection is
closed and removed from the threadLocal when the resquest is destroyed.
If I'm not mistaken, each http request is treated by one thread by
tomcat. So, I have one jdbc connection for each request ( = thread).
My problem appears when I use Ajax. For 2 successive ajax request, I
have the error "Connection closed" : it's a random problem (the
stacktrace is not the same for the 2 attemps and it's not depending of
the thread execution order).
I know this issue :
http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#Random_Connection_Closed_Exceptions
"These can occur when one request gets a db connection from the
connection pool and closes it twice. When using a connection pool,
closing the connection just returns it to the pool for reuse by another
request, it doesn't close the connection. And Tomcat uses multiple
threads to handle concurrent requests"
But, I'm sure, I always close the connection only once.
I use too the "validationQuery" and "testOnBorrow" parameters.
Is it possible that the connection pool returns the same connection for
2 different threads?
So I don't understand why my connection is closed during the treatment.
Thank for your help
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org