com.jcraft.jsch.JSchException: java.io.IOException: 管道关闭 [英] com.jcraft.jsch.JSchException: java.io.IOException: Pipe closed

查看:158
本文介绍了com.jcraft.jsch.JSchException: java.io.IOException: 管道关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Jcraft JSch (http://www.jcraft.com/jsch/).我收到以下错误:

I am trying to copy a file over SFTP to another Host using Jcraft JSch (http://www.jcraft.com/jsch/). I am getting below error:

Connecting via SSH to somehost:22
com.jcraft.jsch.JSchException: java.io.IOException: Pipe closed
at com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:315)
at com.jcraft.jsch.Channel.connect(Channel.java:152)
at com.jcraft.jsch.Channel.connect(Channel.java:145)

相关代码如下:

Channel channel = null;
    ChannelSftp channelSftp = null;
    Exception cause = null;
    try {
      connect();
      channel = session.openChannel( "sftp" );
      channelSftp = (ChannelSftp)channel;
      channelSftp.connect();
      assert channelSftp != null;
      try {
        channelSftp.ls( destDir );
      } catch( SftpException sftpEx ) {
        // Create destination folder, if it does not exist
        execCommand( "some command" + destDir );
      }

自上周以来一切都很好,升级到最新的 jcraft 版本不起作用.我提到了这个this(请参阅页面上的最后一条评论),但可以达不到根本原因.有什么帮助吗?

This was all good since last week, upgrading to latest jcraft version doesn't work. I referred to this and this (refer last comment on page), but could not reach to root cause. Any help?

推荐答案

SSH 运行没有任何问题.问题在于 SSH 配置中的 SFTP 模块路径.以下链接无法访问.

SSH was working without any issue. Problem was with SFTP module path in SSH config. Below link was not accessible.

# override default of no subsystems 
Subsystem sftp /usr/libexec/openssh/sftp-server

这篇关于com.jcraft.jsch.JSchException: java.io.IOException: 管道关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆