JBeret1.0.0 skip problem
TweetPosted on Friday Feb 14, 2014 at 10:07PM in Technology
Problem
- skippable-exception-classes not worked expectedly
- I declared a exception to my jobXML, but it seems just ignored. my batch job stopped at exception and failed.
Environment
- WildFly8.0.0.Final
- Oracle JDK7u51
Project to reproduce the problem
- Entire the project is available at GitHub
Spec
- ItemReader supplies int array which contains 3 items
- ItemProcessor throws RuntimeException at second item
- RuntimeException declared in skippable-exception-classes
How to reproduce
- Deploy the project
- Browse http://localhost:8080/jsr352-skip/
- servlet kicks the batch job
- Check log of application server and job repository
Log
22:03:49,505 INFO [stdout] (batch-batch - 1) readItem: 1 22:03:49,505 INFO [stdout] (batch-batch - 1) process: i=1, item=1 22:03:49,506 INFO [stdout] (batch-batch - 1) readItem: 2 22:03:49,506 ERROR [org.jberet] (batch-batch - 1) JBERET000007: Failed to run job skip, doChunk, org.jberet.job.model.Chunk@50e84eee: java.lang.RuntimeException: I want to skip this! at example.ExampleItemProcessor.processItem(ExampleItemProcessor.java:14) [classes:] at org.jberet.runtime.runner.ChunkRunner.processItem(ChunkRunner.java:396) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:295) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:193) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:204) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final] at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Repository
job_execution
jbatch=# select * from job_execution order by jobexecutionid desc limit 1; jobexecutionid | jobinstanceid | version | createtime | starttime | endtime | lastupdatedtime | batchstatus | exitstatus | jobparameters | restartposition ----------------+---------------+---------+-------------------------+-------------------------+-------------------------+-------------------------+-------------+------------+---------------+----------------- 101 | 96 | | 2014-02-14 22:03:49.478 | 2014-02-14 22:03:49.478 | 2014-02-14 22:03:49.515 | 2014-02-14 22:03:49.515 | FAILED | FAILED | | (1 row) jbatch=#
step_execution
jbatch=# select * from step_execution where jobexecutionid =101; stepexecutionid | jobexecutionid | version | stepname | starttime | endtime | batchstatus | exitstatus | executionexception | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount | readercheckpointinfo | writercheckpointinfo -----------------+----------------+---------+----------+-------------------------+-------------------------+-------------+------------+--------------------------------------------------------------------------------------------------------------------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------+---------------------- 116 | 101 | | doChunk | 2014-02-14 22:03:49.489 | 2014-02-14 22:03:49.508 | FAILED | FAILED | java.lang.RuntimeException: I want to skip this! +| | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | | | | | | | | | at example.ExampleItemProcessor.processItem(ExampleItemProcessor.java:14) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.ChunkRunner.processItem(ChunkRunner.java:396) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:295) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:193) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:204) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) +| | | | | | | | | | | | | | | | | | | at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) +| | | | | | | | | | | | | | | | | | | at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149)+| | | | | | | | | | | | | | | | | | | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) +| | | | | | | | | | | | | | | | | | | at java.util.concurrent.FutureTask.run(FutureTask.java:262) +| | | | | | | | | | | | | | | | | | | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) +| | | | | | | | | | | | | | | | | | | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) +| | | | | | | | | | | | | | | | | | | at java.lang.Thread.run(Thread.java:744) +| | | | | | | | | | | | | | | | | | | at org.jboss.threads.JBossThread.run(JBossThread.java:122) +| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1 row) jbatch=#
Worked expectedly in GlassFish4.0
Log
2014-02-14T22:02:27.017+0900|情報: readItem: 1 2014-02-14T22:02:27.017+0900|情報: process: i=1, item=1 2014-02-14T22:02:27.017+0900|情報: readItem: 2 2014-02-14T22:02:27.017+0900|情報: readItem: 3 2014-02-14T22:02:27.017+0900|情報: process: i=3, item=3 2014-02-14T22:02:27.017+0900|情報: readItem: null 2014-02-14T22:02:27.017+0900|情報: write: [1, 3]
Repository
kyle-no-MacBook:bin kyle$ ./asadmin list-batch-jobs Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 JOBNAME INSTANCECOUNT skip 1 Command list-batch-jobs executed successfully. kyle-no-MacBook:bin kyle$ ./asadmin list-batch-job-steps -l 1 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 STEPNAME STEPID STARTTIME ENDTIME BATCHSTATUS EXITSTATUS STEPMETRICS doChunk 1 Fri Feb 14 22:02:26 JST 2014 Fri Feb 14 22:02:27 JST 2014 COMPLETED COMPLETED METRICNAME VALUE READ_COUNT 3 WRITE_COUNT 2 COMMIT_COUNT 1 ROLLBACK_COUNT 0 READ_SKIP_COUNT 0 PROCESS_SKIP_COUNT 1 FILTER_COUNT 0 WRITE_SKIP_COUNT 0 Command list-batch-job-steps executed successfully. kyle-no-MacBook:bin kyle$
References
Tags: jbatch