Bug 823773 - DB2 & human tasks: Invalid operation: result set is closed
Summary: DB2 & human tasks: Invalid operation: result set is closed
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM Console
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER9
: BRMS 5.3.0.GA
Assignee: Kris Verlaenen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-22 06:50 UTC by Zuzana Krejčová
Modified: 2023-05-31 22:25 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
stack trace of the error from the server log (5.11 KB, text/plain)
2012-05-22 06:50 UTC, Zuzana Krejčová
no flags Details
jboss-brms-ds.xml (1.20 KB, application/xml)
2012-05-24 14:15 UTC, Jiri Locker
no flags Details

Description Zuzana Krejčová 2012-05-22 06:50:57 UTC
Created attachment 585937 [details]
stack trace of the error from the server log

Description of problem:
When running jBPM Console with DB2 database the following error occurs when the console queries for (personal) tasks:
ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-27) [jcc][t4][10120][10898][4.12.55] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null
ERROR [org.jbpm.task.service.TaskServerHandler] (Thread-27) org.hibernate.exception.GenericJDBCException: could not execute query

According to this: http://www-01.ibm.com/support/docview.wss?uid=swg21461670 the cause is that: "The IBM Data Server Driver for JDBC and SQLJ automatically closes the cursor when all rows have been retrieved from a ResultSet. When ResultSet.next is executed after the cursor is closed the SQLException is thrown."

The same page also contains some helpful info on how to resolve this.


Version-Release number of selected component (if applicable):
BRMS 5.3 ER7

Comment 1 Zuzana Krejčová 2012-05-22 07:25:41 UTC
Default assignee is kind of buggy. Reassigning to Marco, as he delt with the previous db2 problem. Feel free to change that.

Comment 2 Marco Rietveld 2012-05-22 11:53:49 UTC
No problem. Thanks for the link to the ibm site, Zuzana.

Comment 3 Marco Rietveld 2012-05-22 12:40:24 UTC
The ibm page seems to imply that this is a bug in hibernate 3.3.2, however maybe there's some way around it.

Comment 4 Marco Rietveld 2012-05-22 19:29:53 UTC
Zuzana, could you check which version of hibernate is being used in your tests? 

I thought it was 3.3.2.GA, but org.hibernate.loader.Loader isn't longer than 2379 lines in 3.3.2.GA (and the stack trace implies it's at least 2458 lines long).

Comment 5 Marco Rietveld 2012-05-22 19:43:40 UTC
Also, could you try testing with the following string appended to the jdbc url: 

";allowNextOnExhaustedResultSet=1"

For example: 

jdbc:db2://db2.qa.redhat.com:50000/jbossqa;allowNextOnExhaustedResultSet=1

Comment 6 Lukáš Petrovický 2012-05-23 06:26:32 UTC
(In reply to comment #4)
> Zuzana, could you check which version of hibernate is being used in your
> tests? 

Looking at the server's Hibernate JARs, they say "3.3.2.GA_CP04"

(In reply to comment #5)
> jdbc:db2://db2.qa.redhat.com:50000/jbossqa;allowNextOnExhaustedResultSet=1

Will try.

Comment 7 Lukáš Petrovický 2012-05-23 10:04:24 UTC
The property added to the URL does actually help. I think that this turns into a documentation issue now. Reassigning to Lee.

Marco, would you be able to provide the BZ/JIRA in Hibernate that causes this? So that we can track it in the future.

Comment 8 Jiri Locker 2012-05-24 14:15:44 UTC
Created attachment 586647 [details]
jboss-brms-ds.xml

Unfortunately we're still getting the SQL exception even with allowNextOnExhaustedResultSet=1. See attached data source. More investigation will be needed.

Comment 9 Marco Rietveld 2012-05-25 13:57:58 UTC
I noticed that the following setting was missing from the ds.xml: 

    <xa-datasource-property name="DriverType">4</xa-datasource-property>

I don't think this the fix, but the following sites seem to indicate that it's needed: 

http://stackoverflow.com/questions/3988059/creating-xa-datasource-to-db2-on-jboss
http://docs.codehaus.org/display/BTM/JdbcXaSupportEvaluation#JdbcXaSupportEvaluation-IBMDB2

Comment 10 Marco Rietveld 2012-05-25 15:52:42 UTC
I've been able to reproduce the problem. 

The solution to this seems to be making sure a transaction happens around queries that find at least one row/result. 

I will probably spend most of the time checking whether it causes other bugs.

Comment 11 Marco Rietveld 2012-05-25 15:58:28 UTC
Sorry, to clarify: I'll be making sure all queries run within a transaction.

Comment 12 Marco Rietveld 2012-05-25 20:21:04 UTC
Finished coding 90% of the solution and currently testing and working out kinks.

Comment 13 Marco Rietveld 2012-05-25 22:21:41 UTC
I've finished testing and coding the solution, and am now organizing the commits and adding some necessary documentation in the code (for developers who look at the code later).

Comment 14 Ryan Zhang 2012-06-13 09:32:49 UTC
This issue's fixes  have been picked by ER9. Please verify them on ER9.

Comment 15 Zuzana Krejčová 2012-06-15 08:17:47 UTC
Works like magic. Thanks.


Note You need to log in before you can comment on or make changes to this bug.