We have been using spring integration/batch in one of our applications. As a part of the batch process, there is an sftp handler that transfers files to a remote sftp server. When the code was newly implemented things were working wonderfully as expected with spring integration 2.1.1 a couple of months back.
Recently a couple of days back, we have started seeing the following exception while making the sftp transfer (which is very much reproducible every time). The underlying API is unable to rename the .writing file to its original file name. This causes an exception and I dug into the Spring Integration API and found the following - Since an exception was thrown while renaming, the API assumes that there is an already existing file with that file name and tries to remove the file from that directory. In reality, we do not have an already existing file with that name in that directory and hence "path is invalid" message is received from SFTP server.
I understand that we can make the use-temporary-filename to false. But, Could any of you please help me in understanding whether there is any problem in the underlying API in this regard? I am not able to say that this is a permission issue since we are able to manually enter into the sftp server and rename the file with .writing extn to the actual file name without errors. - Please help since this is urgent.
Eagerly waiting for some help in this regard..I have spent around 1 full day trying to get out of this issue...but ended up in vain..
Caused by: org.springframework.integration.MessageDeliveryException:
Error handling message for file
[<file path with file name>]
<package name where error occurs>(SftpHandler.java:195)
<package with method name where error occurs>(SftpHandler.java:144)
<package with method name internal - where error occurs>(SftpHandler.java:97)
... 52 more
Caused by: org.springframework.integration.MessagingException: Failed to
'<filename with its extension.writing>'
while uploading the file
... 62 more
Caused by: org.springframework.core.NestedIOException: Failed to delete
file <filename with its extension>; nested
exception is org.springframework.core.NestedIOException: Failed to
remove file: 2: Specified file path is invalid.
... 63 more
Caused by: org.springframework.core.NestedIOException: Failed to remove
file: 2: Specified file path is invalid.
... 65 more