org.springframework.batch.item.ItemStreamException: Failed to initialize the reader on second api call

584 Views Asked by At

getting the error in the title when trying to invoke a springbatchjob secondtime with the same xlsx file.

Technologies used : Springbatch,springboot,mysql,java,springbatchexcel.

1

There are 1 best solutions below

2
On

Without seeing your configuration, my expectation is that your ItemReader is not step scoped. Because of this, you use the same instance across multiple executions which can cause that error. I'd bet if you changed that reader to step scoped, the issue will go away.