• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

This statement has been closed

 
Surender Suri
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am not sure if this is the right section to ask this question. Anyway it is related partly with multi-threading.

We have a web application running on tomcat, using dbcp (1.2) for connection pooling. Our application is heavely multi-threaded and is working fine with no issues, but recently we added a new flow where we are using similar multi threading as in rest of our app and we started seeing below issue consistently.. It does not happen if the new request runs in single thread..

com.app.iqe.utils.ExceptionAdapterException: org.postgresql.util.PSQLException: This ResultSet is closed.
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkClosed(AbstractJdbc2ResultSet.java:2654)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.next(AbstractJdbc2ResultSet.java:1786)
at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:168)
at com.app.iqe.persistence.PersistentManager.processQuery(PersistentManager.java:862)

com.app.iqe.utils.ExceptionAdapterException: org.postgresql.util.PSQLException: This statement has been closed.
at org.postgresql.jdbc2.AbstractJdbc2Statement.checkClosed(AbstractJdbc2Statement.java:2512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.getMaxRows(AbstractJdbc2Statement.java:607)
at org.postgresql.jdbc3.Jdbc3Statement.createResultSet(Jdbc3Statement.java:36)
at org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler.handleResultRows(AbstractJdbc2Statement.java:211)
at org.postgresql.core.v3.QueryExecutorImpl$1.handleResultRows(QueryExecutorImpl.java:437)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1796)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
at com.app.iqe.persistence.PersistentManager.processQuery(PersistentManager.java:846)

Below is the sample code of processQuery method.



Nothing is changed with respect to configuration ect.. the rest of the app and flows works fine. I tried with updating the dbcp jar with latest version, but no effect.

Any idea's on what might be causing the issue? is it multi-threading or connection pooling related ?

Thanks,
Suri
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what is causing your problem but I don't understand why you have the code


at all since the 'finally' clause will close the statement and return the connection to the pool! Also, since both 'stmt' and 'conn' are local variables there is no need to set them to null since they will go out of scope as soon as the method exits.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic