简体   繁体   English

SFTP连接错误

[英]SFTP Connection error

I am using jsch-0.1.51.jar for sftp connection in my program and it was working fine for last 1 year but suddenly program started throwing error : 我在程序中使用sftp连接使用jsch-0.1.51.jar,并且在过去1年中运行良好,但突然程序开始抛出错误:

Algorithm negotiation fail. Below code: 
    =========================================
            jsch.addIdentity(sftpIdentityFilePath);
        logger.info("*****************Getting SFTP Connection******************");
        session = jsch.getSession(sftpUser, sftpHost, 2222);
        System.out.println("crossed seesion initialize");
        session.setConfig("StrictHostKeyChecking", "no");
        System.out.println("crossed seesion config");
        session.connect();
        System.out.println("crossed seesion connect");
        channel= session.openChannel("sftp");
        System.out.println("sftp server connected");
        logger.info("SFTP server connected");
        channel.connect();
        logger.info("*****************SFTP Connected******************");


    ==============================================================    

After finding the issue I have used a updated jar to jsch-0.1.54.jar. 找到问题后,我使用了更新的jar至jsch-0.1.54.jar。 But it's throwing a different exception 但这引发了另一个异常

2018-04-28 18:17:51 ERROR FileCopyMain:978 - 
Session.connect: java.io.IOException: End of IO Stream Read

Also in both this cases when I am trying to run this program from Eclipse IDE then it's working fine. 同样在这两种情况下,当我尝试从Eclipse IDE运行该程序时,它都可以正常工作。 But when I am creating the jar file of this Java code then I am getting these issue. 但是,当我创建此Java代码的jar文件时,却遇到了这些问题。

Context of this SFTP connection code: I am connecting a server using private key to download files to my local 此SFTP连接代码的上下文:我正在使用私钥连接服务器,以将文件下载到本地

Can some body please help me out with this? 能帮我解决这个问题吗?

Algorithm negotiation fail. 算法协商失败。

This means that the client and server side could not agree on the encryption algorithm to be used to keep the SSH connection secure. 这意味着客户端和服务器端无法就用于确保SSH连接安全的加密算法达成共识。 When that happens, the server side will close the connection, leading to the IOException that you see. 发生这种情况时,服务器端将关闭连接,导致您看到IOException。

The most likely explanation is that either the client side SSH implementation is out of date, or the server-side SSH implementation is out of date. 最可能的解释是客户端SSH实现已过期,或者服务器端SSH实现已过期。 There should be some clues in the jcsh "DEBUG" logging; jcsh“ DEBUG”日志中应该有一些线索; see JSch logger - where can I configure the level . 请参阅JSch记录器-在哪里可以配置级别 If that fails, look at the logs on the server side. 如果失败,请查看服务器端的日志。

The solution will depend on what you find. 解决方案取决于您的发现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM