SFTP via JSch is throwing error 4: Failure

喜夏-厌秋 提交于 2019-12-21 03:48:30

问题


I am facing a peculiar issue while trying to SFTP a file from Windows to Unix server. The error "stack trace" is -

4: Failure
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
    at com.jcraft.jsch.ChannelSftp.checkStatus(ChannelSftp.java:2459)
    at com.jcraft.jsch.ChannelSftp._sendCLOSE(ChannelSftp.java:2465)
    at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:683)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:475)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:365)

I have searched a lot on other forums but could not get to the root cause. I have observed one more thing - the file name, I am trying to SFTP, is *.xml when I change it to *.XML the SFTP is "successful". Very weird could not identify the issue. I am trying this using JSch Java API. But I have seen the same issue while trying the WinSCP front end.


回答1:


It is common for OpenSSH SFTP server to return code 4 (Failure) for many different reasons, without giving any details.

You would have to check SFTP server log to find more.




回答2:


I was facing the same issue. Please make sure that your SFTP service is running. And If it is already running then restarting this service should do the trick.




回答3:


I had the same issue. Tried everything, turns out I had set the timeout to what I thought was 30s but it was actually 30ms. Changing it to 30000ms solved the issue.

session.setTimeout(30000);


来源:https://stackoverflow.com/questions/26903923/sftp-via-jsch-is-throwing-error-4-failure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!