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

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"); 

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>

Tags:

Java

Sftp

Jsch