Inaccurate error message when using ResourcelessJobRepository with a partitioned step
Opened this issue · 2 comments
Bug description
The ResourcelessJobRepository cannot be used with a Partitioner:
[main] ERROR org.springframework.batch.core.step.AbstractStep - Encountered an error executing step step in job partitionJob
org.springframework.batch.core.JobExecutionException: Cannot restart step from STARTING status. The old execution may still be executing, so you may need to verify manually that this is the case.
Steps to reproduce
Simply change spring-batch-samples/src/main/resources/simple-job-launcher-context.xml
to use ResourcelessJobRepository
and then run spring-batch-samples/src/test/java/org/springframework/batch/samples/partition/file/PartitionFileJobFunctionalTests.java
The resourceless job repository does not support features involving the execution context (including partitioned steps). This is mentioned in the javadocs of the class: https://docs.spring.io/spring-batch/docs/current/api/org/springframework/batch/core/repository/support/ResourcelessJobRepository.html and in the reference docs here: https://docs.spring.io/spring-batch/reference/whatsnew.html#new-resourceless-job-repository
You need to configure another job repository implementation that supports batch-metadata. I am closing this issue now as I believe it answers your concern, but please add a comment if you need more support on this. Thank you.
I must admit the error message is confusing, there is no restart in that sample yet the message is mentioning restart. I will re-open this issue and change it into an enhancement.