1 2 Previous Next 23 Replies Latest reply on Aug 8, 2016 11:02 AM by cfang Go to original post
      • 15. Re: Result set is closed
        cfang

        db2 docs seems to sugguest using int value, instead of "YES":

         

          <property name="properties" value="allowNextOnExhaustedResultSet=1"/>


        Using int value when appending to url might also work.

        • 16. Re: Result set is closed
          richardmoore

          Here is the results -

           

          Invalid database URL syntax: jdbc:db2://trhdb2:60000/awgt1:allowNextOnExhaustedResultSet=1. ERRORCODE=-4461, SQLSTATE=42815

           

          <property name="properties" value="allowNextOnExhaustedResultSet=1"/>

          Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null

          • 17. Re: Result set is closed
            jamezp

            Is there any kind of stack trace further up the logs? You might have to debug to see if ItemReader.close() is getting invoked and there is an attempt to read afterwards.

             

            --

            James R. Perkins

            • 18. Re: Result set is closed
              richardmoore

              The following is all that I get. Guess it is down to running debug -

               

              2016-08-04 16:13:32.112 [jberet-1    ]                         jberet - [TRACE] JBERET000022: setTransactionTimeout is not implemented for local transactions

              2016-08-04 16:13:36.058 [jberet-1    ]                        support - [TRACE] Open CsvItemWriter with checkpoint null, which is ignored for CsvItemWriter.

               

               

              2016-08-04 16:13:36.128 [jberet-1    ]                        support - [INFO ] JBERET060501: Opening resource MyBatchletTest_test.out in class org.jberet.support.io.CsvItemWriter

              2016-08-04 16:13:36.144 [jberet-1    ]                        support - [TRACE] About to write items, number of items 10, element type class java.util.ArrayList

               

               

              2016-08-04 16:13:36.223 [jberet-1    ]                         jberet - [ERROR] ProcessingInfo{count=3, timerExpired=false, itemState=RUNNING, chunkState=RUNNING, checkpointPosition=9, readPosition=13, failurePoint=null}

              2016-08-04 16:13:36.254 [jberet-1    ]                         jberet - [ERROR] item-count=10, time-limit=0, skip-limit=-1, skipCount=0, retry-limit=-1, retryCount=0

              2016-08-04 16:13:36.254 [jberet-1    ]                         jberet - [ERROR] JBERET000007: Failed to run job myjob, test, org.jberet.job.model.Chunk@856b65

              com.ibm.db2.jcc.am.SqlException: [jcc][t4][10120][10898][3.63.123] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null

                at com.ibm.db2.jcc.am.fd.a(fd.java:663) ~[db2jcc.jar:?]

                at com.ibm.db2.jcc.am.fd.a(fd.java:60) ~[db2jcc.jar:?]

                at com.ibm.db2.jcc.am.fd.a(fd.java:103) ~[db2jcc.jar:?]

                at com.ibm.db2.jcc.am.vn.Db(vn.java:4528) ~[db2jcc.jar:?]

                at com.ibm.db2.jcc.am.vn.B(vn.java:2184) ~[db2jcc.jar:?]

                at com.ibm.db2.jcc.am.vn.getRow(vn.java:2172) ~[db2jcc.jar:?]

                at org.jberet.support.io.JdbcItemReader.readItem(JdbcItemReader.java:304) ~[jberet-support-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.ChunkRunner.readItem(ChunkRunner.java:359) ~[jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:305) ~[jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:201) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:226) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:147) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:128) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:203) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:128) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:203) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:60) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99) [jberet-core-1.3.0.Beta2.jar:1.3.0.Beta2]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_73]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_73]

                at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]

              2016-08-04 16:13:36.254 [jberet-1    ]                        support - [INFO ] JBERET060502: Closing resource MyBatchletTest_test.out in class org.jberet.support.io.CsvItemWriter

              • 19. Re: Result set is closed
                richardmoore

                I was looking at the stacktrace, specifically -

                     at org.jberet.support.io.JdbcItemReader.readItem(JdbcItemReader.java:304) ~[jberet-support-1.3.0.Beta2.jar:1.3.0.Beta2]

                which points to the line of code -

                   currentRowNumber = resultSet.getRow();

                at this point the -

                   if (resultSet.next())

                has resulted in false, no more rows, you cannot issue another statement against the closed (by DB2 per their specification) and not cause -

                   Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null

                Should the currentRowNumber even be incremented since you didn't get a row?

                I setup my own test and tried exactly this and I get the same error when I try to do the getRow().


                Also, where do I find the definitions for what class is being used for the ref="jdbcItemReader"?

                • 20. Re: Result set is closed
                  cfang

                  It's org.jberet.support.io.JdbcItemReader.

                   

                  https://github.com/jberet/jsr352/blob/master/jberet-support/src/main/java/org/jberet/support/io/JdbcItemReader.java

                   

                  The source jar can be downloaded from maven central searching for jberet-support The Central Repository Search Engine

                   

                  You raised a good point.  ResultSet javadocs ResultSet (Java Platform SE 7 ) has this:

                   

                  When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown.

                   

                  I"ll look into this.

                  • 21. Re: Result set is closed
                    cfang

                    I was able to reproduce the problem with db2 9.7.  If I change jdbcItemReader to call resultSet.getRows only when next() returns true, the problem went away.

                     

                    I'll fix it in jberet-support master branch GitHub - jberet/jsr352: Implementation of JSR 352

                     

                    [JBERET-253] jdbcItemReader on db2: Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null - JBoss Issu…

                     

                    Thanks for analyzing the issue.

                    • 22. Re: Result set is closed
                      richardmoore

                      Do I need to create a new jberet-support-1.3.?.Beta2.jar or is it out there for me to download with this fix?

                      • 23. Re: Result set is closed
                        cfang

                        The fix has been committed and pushed to jberet master at github, and will be included in the next release out of the master branch.  For now you will need to build your own jberet-support.jar.

                         

                        The real code change is one or two lines, barring test code.

                        1 2 Previous Next