The following description is copied from the stackoverflow question and its comments:
Is there any listener interface that one could implement to handle exceptions thrown from ItemReader.open() methods? There's plenty of listener interfaces but no one seems to be suitable for this. i.e. ItemReadListener catches only exceptions from ItemReader.readItem() (similar to ChunkListener or ItemProcessListener etc.)
There are JobListener and StepListener interfaces but these two don't define methods that would be called in case of exception.
Is there any way how to do this?
You may be able to use ChunkListener#onError(Exception e) to "catch" any exception within a chunk. This will work in certain implementations, like WebSphere Liberty / Open Liberty, but may not work in every implementation (since this was a grey area of the specification).
ItemReader.open() is out of the scope of ChukListener. If I understand the concept correctly open() is called before the chunks are performed. However ChukListener.onError() doesn't catch the excpetion. At least in the JBeret implementation of JSR352