I have a problem doing file transfers with a SftpOutboundGateway within a Spring task. The files which I do transfer are pretty normal in respect to size. I am using com.jcraft::jsch.jar-0.1.55.
It says:
2024-01-18T12:15:00.884+01:00 INFO [] --- [job-thread1] com.harry.potter.mail.service.EmailServiceImpl: sendHtmlMessage, Mail subj myJob TEST notification MyDataExport
2024-01-18T12:15:01.065+01:00 INFO [] --- [job-thread1] com.harry.potter.job.myJobTask: MyDataExport finished
2024-01-18T12:15:01.065+01:00 INFO [] --- [job-thread1] job-MyDataExport: Job finished, status OKAY
2024-01-18T13:15:00.869+01:00 INFO [] --- [Connect thread transfer.harry.potter.de session] com.jcraft.jsch: Caught an exception, leaving main loop due to End of IO Stream Read
2024-01-18T13:15:00.869+01:00 INFO [] --- [Connect thread transfer.harry.potter.de session] com.jcraft.jsch: Disconnecting from transfer.harry.potter.de port 22
The task is long finished when about an hour later the exception occures. What makes it worse: the Spring scheduler seemed to stop with this exception and the task and any following tasks are no longer executed. I then would need to restart the Spring Boot application's context.
How am I able to catch such an exception? Or how can I avoid the exception itself?