This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
I've done a simulation of a VM halt using a debugger and stopping the VM in the middle of a job execution. When I try to restart the job I get a JobExecutionAlreadyRunningException. Is this the expected behavior? How can I recover from a VM halt?
The problem you are seeing is because the Status in the database was never updated to reflect that the job failed. In order to get it to restart you will have to update STATUS for the affected Job Execution in the BATCH_JOB_EXECUTION table to FAILED.
I managed to restart the job updating END_TIME and STATUS. Still I'd like to understand whether this is a missing feature or there is any limitation to restart the job. I mean, the job hasn't been marked as completed in the database, and there is no such job actually running. Isn't there any memory registry of the jobs running in a given moment that could be used to guarantee the job is not running and so can be restarted? It seems to me that Spring Batch is not following ACID principles accordingly.