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..
Code:at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.integration.MessageDeliveryException: Error handling message for file [<file path with file name>] at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.handleMessageInternal(FileTransferringMessageHandler.java:166) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128) at <package name where error occurs>(SftpHandler.java:195) at <package with method name where error occurs>(SftpHandler.java:144) at <package with method name internal - where error occurs>(SftpHandler.java:97) at ... 52 more Caused by: org.springframework.integration.MessagingException: Failed to write to '<filename with its extension.writing>' while uploading the file at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.sendFileToRemoteDirectory(FileTransferringMessageHandler.java:249) at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.handleMessageInternal(FileTransferringMessageHandler.java:155) ... 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. at org.springframework.integration.sftp.session.SftpSession.rename(SftpSession.java:159) at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.rename(CachingSessionFactory.java:157) at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.sendFileToRemoteDirectory(FileTransferringMessageHandler.java:245) ... 63 more Caused by: org.springframework.core.NestedIOException: Failed to remove file: 2: Specified file path is invalid. at org.springframework.integration.sftp.session.SftpSession.remove(SftpSession.java:73) at org.springframework.integration.sftp.session.SftpSession.rename(SftpSession.java:153) ... 65 more ------


Reply With Quote
