JSch 0.1.53 session.connect() throws “End of IO Stream Read”

前端 未结 3 579
灰色年华
灰色年华 2020-12-18 23:23

I downloaded a new JSch 0.1.53 library and JSch (sftp) download task no longer works. This release fails on session.connect() function throwing an error S

相关标签:
3条回答
  • 2020-12-18 23:27

    The JSch 0.1.53 supports (and prefers) the diffie-hellman-group-exchange-sha256 KEX, what the server claims to support too, so the JSch tries to use it.

    For some reason the server disconnects you afterwards.

    To workaround that, force the JSch to use the diffie-hellman-group1-sha1 KEX, what the JSch 0.1.52 prefers:

    session.setConfig("kex", "diffie-hellman-group1-sha1"); 
    
    0 讨论(0)
  • 2020-12-18 23:31

    I had an same problem i just changed the jsch version to 0.1.54 and got solved

    add this to your pom.xml

    <dependency>
       <groupId>com.jcraft</groupId>
       <artifactId>jsch</artifactId>
       <version>0.1.54</version>
    </dependency>
    
    0 讨论(0)
  • 2020-12-18 23:34

    After trying out many solutions, below solved my issue

    • Open ssh server's sshd_config in a text editor and add below line to the end of the file:

      KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
      
    • After editing the file ensure you restart you ssh service

    0 讨论(0)
提交回复
热议问题