I am trying to sft file to mainframe using spring integration sftp:outbound-gateway: this is configuration:
<sftp:outbound-gateway id="putGateway"
session-factory="sftpSessionFactory"
request-channel="sftpFileInputChannel"
command="put"
expression="payload"
remote-directory="${remote.upload.directory}"
remote-filename-generator-expression="'${remote.upload.filename}'"
use-temporary-file-name="false"
reply-channel="replayFromPutSftpChannel"/>
where
remote.upload.filename.credit.fmpl=/!DTS4.UP.G3TRF.S60304
remote.upload.directory=/
I am getting exception like :
Caused by: org.springframework.integration.MessagingException: Failed to write to '//!DTS4.UP.G3TRF.S60304' while uploading the file
at org.springframework.integration.file.remote.RemoteFileTemplate.sendFileToRemoteDirectory(RemoteFileTemplate.java:392)
at org.springframework.integration.file.remote.RemoteFileTemplate.access$500(RemoteFileTemplate.java:56)
at org.springframework.integration.file.remote.RemoteFileTemplate$1.doInSession(RemoteFileTemplate.java:213)
... 46 more
Caused by: org.springframework.core.NestedIOException: failed to write file; nested exception is 3: Permission denied
at org.springframework.integration.sftp.session.SftpSession.write(SftpSession.java:158)
at org.springframework.integration.file.remote.RemoteFileTemplate.sendFileToRemoteDirectory(RemoteFileTemplate.java:385)
... 48 more
Caused by: 3: Permission denied
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2629)
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:545)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:491)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:454)
at org.springframework.integration.sftp.session.SftpSession.write(SftpSession.java:155)
If I am uploading from command line using sftp client, the following works :
put filename //!DTS4.UP.G3TRF.S60304
but via spring integration , it does not. The server, I am trying to sftp to is : IBM z/OS mainframe .
Please help if you know how to resolve the issue.
Thank you, Anna
Another quete:
So, your issue that your SFTP path starts with
/
. The code fromChannelSftp.put
:Try to figure out how to avoid
/
in the beginning.