java.lang.RuntimeException: Always fail here!

Spring JIRA | David Berkman | 3 years ago
  1. 0

    Under spring-batch 3.0.0M3 when a partitioned step is run the first time, the master is started and correctly constructs and executes each of the partitioned sub-steps. However, if the same job is re-submitted (due to the job not completing), then, even when the master step is marked as allow-start-if-complete="true", the sub-steps are never executed. This is confirmed by looking at the batch_step_execution table, showing only the master completing, and also by dropping break points in the partitioned step code, confirming that the objects are never instantiated nor called. The partitioned sub-step does not take the allow-start-if-complete attribute, so there's no help there. Here's the output from 2 test runs loading the same job, which has failed on the second step each time. The first time we can see the full output from the partitioned first step, while on the second run we get no output from the actual step at all, even though the task is marked to run even if complete. This works as expected when the step is not partitioned, running completely each time. I've attached the complete maven project for this test case. You won't be able to run it due to missing dependencies, but if you swap your own database setup in to the included spring files, and correct the dependencies in the pom, everything else should run fine, and you should see the same results. Output from the first run: 2014-05-06T14:31:48.920-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:31:48.954-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 0 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 0 2014-05-06T14:31:49.059-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 0 2014-05-06T14:31:49.075-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 0 2014-05-06T14:31:49.086-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 1 2014-05-06T14:31:49.087-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 2 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 2 2014-05-06T14:31:49.112-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 1 2014-05-06T14:31:49.113-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 1 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 2 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 2 2014-05-06T14:31:49.250-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:31:49.258-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:31:49.276-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:31:49.277-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Output from the second run: 2014-05-06T14:33:55.515-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:33:55.555-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:33:55.656-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:33:55.674-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:33:55.691-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:33:55.691-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Notice the complete lack of output from the configured Reader and Writer, because they are never called, because the actual sub-partitioned steps are never executed, even though the master step is marked as allow-start-if-complete="true". The step executions in the database are logged as... 1 2 demoStep 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 20 15 0 15 0 0 0 0 COMPLETED 2014-05-06 14:31:49 2 6 demoStep:demo_partitioned_step:1 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 3 6 demoStep:demo_partitioned_step:0 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 4 6 demoStep:demo_partitioned_step:4 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 5 6 demoStep:demo_partitioned_step:3 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 6 6 demoStep:demo_partitioned_step:2 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 7 2 alwaysFail 1 2014-05-06 14:31:49 2014-05-06 14:31:49 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:31:49 8 2 demoStep 2 2014-05-06 14:33:56 2014-05-06 14:33:56 COMPLETED 0 0 0 0 0 0 0 0 COMPLETED 2014-05-06 14:33:56 9 2 alwaysFail 2 2014-05-06 14:33:56 2014-05-06 14:33:56 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:33:56 Which shows that the master step is called, but none of the sub-partition steps are executed.

    Spring JIRA | 3 years ago | David Berkman
    java.lang.RuntimeException: Always fail here!
  2. 0

    Under spring-batch 3.0.0M3 when a partitioned step is run the first time, the master is started and correctly constructs and executes each of the partitioned sub-steps. However, if the same job is re-submitted (due to the job not completing), then, even when the master step is marked as allow-start-if-complete="true", the sub-steps are never executed. This is confirmed by looking at the batch_step_execution table, showing only the master completing, and also by dropping break points in the partitioned step code, confirming that the objects are never instantiated nor called. The partitioned sub-step does not take the allow-start-if-complete attribute, so there's no help there. Here's the output from 2 test runs loading the same job, which has failed on the second step each time. The first time we can see the full output from the partitioned first step, while on the second run we get no output from the actual step at all, even though the task is marked to run even if complete. This works as expected when the step is not partitioned, running completely each time. I've attached the complete maven project for this test case. You won't be able to run it due to missing dependencies, but if you swap your own database setup in to the included spring files, and correct the dependencies in the pom, everything else should run fine, and you should see the same results. Output from the first run: 2014-05-06T14:31:48.920-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:31:48.954-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 0 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 0 2014-05-06T14:31:49.059-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 0 2014-05-06T14:31:49.075-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 0 2014-05-06T14:31:49.086-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 1 2014-05-06T14:31:49.087-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 2 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 2 2014-05-06T14:31:49.112-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 1 2014-05-06T14:31:49.113-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 1 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 2 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 2 2014-05-06T14:31:49.250-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:31:49.258-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:31:49.276-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:31:49.277-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Output from the second run: 2014-05-06T14:33:55.515-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:33:55.555-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:33:55.656-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:33:55.674-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:33:55.691-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:33:55.691-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Notice the complete lack of output from the configured Reader and Writer, because they are never called, because the actual sub-partitioned steps are never executed, even though the master step is marked as allow-start-if-complete="true". The step executions in the database are logged as... 1 2 demoStep 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 20 15 0 15 0 0 0 0 COMPLETED 2014-05-06 14:31:49 2 6 demoStep:demo_partitioned_step:1 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 3 6 demoStep:demo_partitioned_step:0 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 4 6 demoStep:demo_partitioned_step:4 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 5 6 demoStep:demo_partitioned_step:3 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 6 6 demoStep:demo_partitioned_step:2 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 7 2 alwaysFail 1 2014-05-06 14:31:49 2014-05-06 14:31:49 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:31:49 8 2 demoStep 2 2014-05-06 14:33:56 2014-05-06 14:33:56 COMPLETED 0 0 0 0 0 0 0 0 COMPLETED 2014-05-06 14:33:56 9 2 alwaysFail 2 2014-05-06 14:33:56 2014-05-06 14:33:56 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:33:56 Which shows that the master step is called, but none of the sub-partition steps are executed.

    Spring JIRA | 3 years ago | David Berkman
    java.lang.RuntimeException: Always fail here!
  3. 0

    Under spring-batch 3.0.0M3 when a partitioned step is run the first time, the master is started and correctly constructs and executes each of the partitioned sub-steps. However, if the same job is re-submitted (due to the job not completing), then, even when the master step is marked as allow-start-if-complete="true", the sub-steps are never executed. This is confirmed by looking at the batch_step_execution table, showing only the master completing, and also by dropping break points in the partitioned step code, confirming that the objects are never instantiated nor called. The partitioned sub-step does not take the allow-start-if-complete attribute, so there's no help there. Here's the output from 2 test runs loading the same job, which has failed on the second step each time. The first time we can see the full output from the partitioned first step, while on the second run we get no output from the actual step at all, even though the task is marked to run even if complete. This works as expected when the step is not partitioned, running completely each time. I've attached the complete maven project for this test case. You won't be able to run it due to missing dependencies, but if you swap your own database setup in to the included spring files, and correct the dependencies in the pom, everything else should run fine, and you should see the same results. Output from the first run: 2014-05-06T14:31:48.920-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:31:48.954-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 0 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 0 2014-05-06T14:31:49.059-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 0 2014-05-06T14:31:49.075-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 0 2014-05-06T14:31:49.086-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 1 2014-05-06T14:31:49.087-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 2 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 2 2014-05-06T14:31:49.112-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 1 2014-05-06T14:31:49.113-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 1 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 2 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 2 2014-05-06T14:31:49.250-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:31:49.258-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:31:49.276-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:31:49.277-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Output from the second run: 2014-05-06T14:33:55.515-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:33:55.555-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:33:55.656-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:33:55.674-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:33:55.691-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:33:55.691-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Notice the complete lack of output from the configured Reader and Writer, because they are never called, because the actual sub-partitioned steps are never executed, even though the master step is marked as allow-start-if-complete="true". The step executions in the database are logged as... 1 2 demoStep 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 20 15 0 15 0 0 0 0 COMPLETED 2014-05-06 14:31:49 2 6 demoStep:demo_partitioned_step:1 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 3 6 demoStep:demo_partitioned_step:0 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 4 6 demoStep:demo_partitioned_step:4 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 5 6 demoStep:demo_partitioned_step:3 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 6 6 demoStep:demo_partitioned_step:2 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 7 2 alwaysFail 1 2014-05-06 14:31:49 2014-05-06 14:31:49 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:31:49 8 2 demoStep 2 2014-05-06 14:33:56 2014-05-06 14:33:56 COMPLETED 0 0 0 0 0 0 0 0 COMPLETED 2014-05-06 14:33:56 9 2 alwaysFail 2 2014-05-06 14:33:56 2014-05-06 14:33:56 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:33:56 Which shows that the master step is called, but none of the sub-partition steps are executed.

    Spring JIRA | 3 years ago | David Berkman
    java.lang.RuntimeException: Always fail here!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Under spring-batch 3.0.0M3 when a partitioned step is run the first time, the master is started and correctly constructs and executes each of the partitioned sub-steps. However, if the same job is re-submitted (due to the job not completing), then, even when the master step is marked as allow-start-if-complete="true", the sub-steps are never executed. This is confirmed by looking at the batch_step_execution table, showing only the master completing, and also by dropping break points in the partitioned step code, confirming that the objects are never instantiated nor called. The partitioned sub-step does not take the allow-start-if-complete attribute, so there's no help there. Here's the output from 2 test runs loading the same job, which has failed on the second step each time. The first time we can see the full output from the partitioned first step, while on the second run we get no output from the actual step at all, even though the task is marked to run even if complete. This works as expected when the step is not partitioned, running completely each time. I've attached the complete maven project for this test case. You won't be able to run it due to missing dependencies, but if you swap your own database setup in to the included spring files, and correct the dependencies in the pom, everything else should run fine, and you should see the same results. Output from the first run: 2014-05-06T14:31:48.920-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:31:48.954-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 0 2014-05-06T14:31:49.058-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 0 2014-05-06T14:31:49.059-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 0 2014-05-06T14:31:49.060-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 0 2014-05-06T14:31:49.074-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 0 2014-05-06T14:31:49.075-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 0 2014-05-06T14:31:49.076-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 0 2014-05-06T14:31:49.086-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 1 2014-05-06T14:31:49.087-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 1 2014-05-06T14:31:49.089-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 1 2014-05-06T14:31:49.099-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 1 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Read: 2 2014-05-06T14:31:49.100-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-4] - Partition: 3, Write: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Read: 2 2014-05-06T14:31:49.106-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-5] - Partition: 2, Write: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Read: 2 2014-05-06T14:31:49.107-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-3] - Partition: 4, Write: 2 2014-05-06T14:31:49.112-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 1 2014-05-06T14:31:49.113-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 1 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Read: 2 2014-05-06T14:31:49.115-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-1] - Partition: 1, Write: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Read: 2 2014-05-06T14:31:49.120-0700 com.icix.spbatchjira.DoNothingItemReader INFO (.:) [SimpleAsyncTaskExecutor-2] - Partition: 0, Write: 2 2014-05-06T14:31:49.250-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:31:49.258-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:31:49.276-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:31:49.277-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Output from the second run: 2014-05-06T14:33:55.515-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] launched with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] 2014-05-06T14:33:55.555-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [demoStep] 2014-05-06T14:33:55.656-0700 org.springframework.batch.core.job.SimpleStepHandler INFO (.:) [main] - Executing step: [alwaysFail] 2014-05-06T14:33:55.674-0700 org.springframework.batch.core.step.AbstractStep ERROR (.:) [main] - Encountered an error executing the step Exception in thread java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at com.icix.spbatchjira.Test.main(Test.java:27) 2014-05-06T14:33:55.691-0700 org.springframework.batch.core.launch.support.SimpleJobLauncher INFO (.:) [main] - Job: [FlowJob: [name=demoJob]] completed with the following parameters: [{com.icix.spbatchjira.job_identifier=abc}] and the following status: [FAILED] 2014-05-06T14:33:55.691-0700 com.icix.spbatchjira.Test INFO (.:) [main] - Done................................................ Notice the complete lack of output from the configured Reader and Writer, because they are never called, because the actual sub-partitioned steps are never executed, even though the master step is marked as allow-start-if-complete="true". The step executions in the database are logged as... 1 2 demoStep 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 20 15 0 15 0 0 0 0 COMPLETED 2014-05-06 14:31:49 2 6 demoStep:demo_partitioned_step:1 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 3 6 demoStep:demo_partitioned_step:0 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 4 6 demoStep:demo_partitioned_step:4 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 5 6 demoStep:demo_partitioned_step:3 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 6 6 demoStep:demo_partitioned_step:2 1 2014-05-06 14:31:49 2014-05-06 14:31:49 COMPLETED 4 3 0 3 0 0 0 0 COMPLETED 2014-05-06 14:31:49 7 2 alwaysFail 1 2014-05-06 14:31:49 2014-05-06 14:31:49 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:31:49 8 2 demoStep 2 2014-05-06 14:33:56 2014-05-06 14:33:56 COMPLETED 0 0 0 0 0 0 0 0 COMPLETED 2014-05-06 14:33:56 9 2 alwaysFail 2 2014-05-06 14:33:56 2014-05-06 14:33:56 FAILED 0 0 0 0 0 0 0 1 FAILED java.lang.RuntimeException: Always fail here! at com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14) ... at org.springframework.bat 2014-05-06 14:33:56 Which shows that the master step is called, but none of the sub-partition steps are executed.

    Spring JIRA | 3 years ago | David Berkman
    java.lang.RuntimeException: Always fail here!

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.RuntimeException

      Always fail here!

      at com.icix.spbatchjira.AlwaysFailingTasklet.execute()
    2. com.icix.spbatchjira
      AlwaysFailingTasklet.execute
      1. com.icix.spbatchjira.AlwaysFailingTasklet.execute(AlwaysFailingTasklet.java:14)
      1 frame