“session is down” error when opening an SSH channel with JSch





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







6















I have made an SSH client with JSch. The client is working correctly with my Apache Mina SSH server. But when I test it with a real equipment, it fails.



This is the code of the client:



public boolean openConnection() throws ItsSshException {

boolean connectSuccess = false;
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
jschSSH.setConfig(config);
try {
sshSession = jschSSH.getSession(username, hostname, port);
sshSession.setPassword(password);
sshSession.connect(connectionTimeout);
LOGGER.info("Connection timeout : " + connectionTimeout);
Thread.sleep(1000);
sshHChannel = sshSession.openChannel("shell");
sshHChannel.connect();
in = sshHChannel.getInputStream();
out = new PrintStream(sshHChannel.getOutputStream());
clearInitialSocketState();
connectSuccess = true;
} catch (Exception e) {
LOGGER.error("Error during connecting to host: " + hostname +
", port: " + port + "!", e);
throw new ItsSshException("Error during connecting to host: " + e.getMessage());
}
LOGGER.info("connectSuccess : " + connectSuccess);
return connectSuccess;
}


The code is failing at this point:



sshHChannel = sshSession.openChannel("shell");



Error during connecting to host: 127.0.0.1, port: 22!

com.jcraft.jsch.JSchException: session is down

at com.jcraft.jsch.Session.openChannel(Session.java:861)




My question is how to fix this problem and what can make it to occure?



This is JSch log:



INFO: Connecting to 127.0.0.1 port 22 
INFO: Connection established
INFO: Remote version string: SSH-2.0-Mocana SSH
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: aes256-ctr is not available.
INFO: aes192-ctr is not available.
INFO: aes256-cbc is not available.
INFO: aes192-cbc is not available.
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-cbc hmac-md5 none
INFO: kex: client->server aes128-cbc hmac-md5 none
INFO: SSH_MSG_KEXDH_INIT sent
INFO: expecting SSH_MSG_KEXDH_REPLY
INFO: ssh_rsa_verify: signature true
WARN: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
INFO: SSH_MSG_NEWKEYS sent
INFO: SSH_MSG_NEWKEYS received
INFO: SSH_MSG_SERVICE_REQUEST sent
INFO: SSH_MSG_SERVICE_ACCEPT received
INFO: Authentications that can continue: publickey,keyboard-interactive,password
INFO: Next authentication method: publickey
INFO: Authentications that can continue: keyboard-interactive,password
INFO: Next authentication method: keyboard-interactive
INFO: Authentications that can continue: password
INFO: Next authentication method: password
INFO: Authentication succeeded (password).
INFO: Caught an exception, leaving main loop due to End of IO Stream Read
INFO: Disconnecting from 127.0.0.1 port 22









share|improve this question

























  • The exception is in openChannel. On this row: sshHChannel = sshSession.openChannel("shell");

    – xmlParser
    Nov 21 '17 at 8:04











  • And btw about the seccond comment. I gave you reputation about the answer because it helped me at the first point. But my question then was more complicated and thats why it didnt helped me in the discusion.

    – xmlParser
    Nov 21 '17 at 8:06






  • 1





    Moreover, you are already using LOGGER.info, so why don't you use that?

    – Martin Prikryl
    Nov 21 '17 at 10:53






  • 1





    Is this your post? stackoverflow.com/q/47411185/850848

    – Martin Prikryl
    Nov 21 '17 at 11:19






  • 1





    Why do you have Thread.sleep(1000); there? + Can you add timestamps to the log? And include a log entry before the sshSession.openChannel("shell");?

    – Martin Prikryl
    Nov 21 '17 at 12:48


















6















I have made an SSH client with JSch. The client is working correctly with my Apache Mina SSH server. But when I test it with a real equipment, it fails.



This is the code of the client:



public boolean openConnection() throws ItsSshException {

boolean connectSuccess = false;
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
jschSSH.setConfig(config);
try {
sshSession = jschSSH.getSession(username, hostname, port);
sshSession.setPassword(password);
sshSession.connect(connectionTimeout);
LOGGER.info("Connection timeout : " + connectionTimeout);
Thread.sleep(1000);
sshHChannel = sshSession.openChannel("shell");
sshHChannel.connect();
in = sshHChannel.getInputStream();
out = new PrintStream(sshHChannel.getOutputStream());
clearInitialSocketState();
connectSuccess = true;
} catch (Exception e) {
LOGGER.error("Error during connecting to host: " + hostname +
", port: " + port + "!", e);
throw new ItsSshException("Error during connecting to host: " + e.getMessage());
}
LOGGER.info("connectSuccess : " + connectSuccess);
return connectSuccess;
}


The code is failing at this point:



sshHChannel = sshSession.openChannel("shell");



Error during connecting to host: 127.0.0.1, port: 22!

com.jcraft.jsch.JSchException: session is down

at com.jcraft.jsch.Session.openChannel(Session.java:861)




My question is how to fix this problem and what can make it to occure?



This is JSch log:



INFO: Connecting to 127.0.0.1 port 22 
INFO: Connection established
INFO: Remote version string: SSH-2.0-Mocana SSH
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: aes256-ctr is not available.
INFO: aes192-ctr is not available.
INFO: aes256-cbc is not available.
INFO: aes192-cbc is not available.
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-cbc hmac-md5 none
INFO: kex: client->server aes128-cbc hmac-md5 none
INFO: SSH_MSG_KEXDH_INIT sent
INFO: expecting SSH_MSG_KEXDH_REPLY
INFO: ssh_rsa_verify: signature true
WARN: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
INFO: SSH_MSG_NEWKEYS sent
INFO: SSH_MSG_NEWKEYS received
INFO: SSH_MSG_SERVICE_REQUEST sent
INFO: SSH_MSG_SERVICE_ACCEPT received
INFO: Authentications that can continue: publickey,keyboard-interactive,password
INFO: Next authentication method: publickey
INFO: Authentications that can continue: keyboard-interactive,password
INFO: Next authentication method: keyboard-interactive
INFO: Authentications that can continue: password
INFO: Next authentication method: password
INFO: Authentication succeeded (password).
INFO: Caught an exception, leaving main loop due to End of IO Stream Read
INFO: Disconnecting from 127.0.0.1 port 22









share|improve this question

























  • The exception is in openChannel. On this row: sshHChannel = sshSession.openChannel("shell");

    – xmlParser
    Nov 21 '17 at 8:04











  • And btw about the seccond comment. I gave you reputation about the answer because it helped me at the first point. But my question then was more complicated and thats why it didnt helped me in the discusion.

    – xmlParser
    Nov 21 '17 at 8:06






  • 1





    Moreover, you are already using LOGGER.info, so why don't you use that?

    – Martin Prikryl
    Nov 21 '17 at 10:53






  • 1





    Is this your post? stackoverflow.com/q/47411185/850848

    – Martin Prikryl
    Nov 21 '17 at 11:19






  • 1





    Why do you have Thread.sleep(1000); there? + Can you add timestamps to the log? And include a log entry before the sshSession.openChannel("shell");?

    – Martin Prikryl
    Nov 21 '17 at 12:48














6












6








6


2






I have made an SSH client with JSch. The client is working correctly with my Apache Mina SSH server. But when I test it with a real equipment, it fails.



This is the code of the client:



public boolean openConnection() throws ItsSshException {

boolean connectSuccess = false;
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
jschSSH.setConfig(config);
try {
sshSession = jschSSH.getSession(username, hostname, port);
sshSession.setPassword(password);
sshSession.connect(connectionTimeout);
LOGGER.info("Connection timeout : " + connectionTimeout);
Thread.sleep(1000);
sshHChannel = sshSession.openChannel("shell");
sshHChannel.connect();
in = sshHChannel.getInputStream();
out = new PrintStream(sshHChannel.getOutputStream());
clearInitialSocketState();
connectSuccess = true;
} catch (Exception e) {
LOGGER.error("Error during connecting to host: " + hostname +
", port: " + port + "!", e);
throw new ItsSshException("Error during connecting to host: " + e.getMessage());
}
LOGGER.info("connectSuccess : " + connectSuccess);
return connectSuccess;
}


The code is failing at this point:



sshHChannel = sshSession.openChannel("shell");



Error during connecting to host: 127.0.0.1, port: 22!

com.jcraft.jsch.JSchException: session is down

at com.jcraft.jsch.Session.openChannel(Session.java:861)




My question is how to fix this problem and what can make it to occure?



This is JSch log:



INFO: Connecting to 127.0.0.1 port 22 
INFO: Connection established
INFO: Remote version string: SSH-2.0-Mocana SSH
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: aes256-ctr is not available.
INFO: aes192-ctr is not available.
INFO: aes256-cbc is not available.
INFO: aes192-cbc is not available.
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-cbc hmac-md5 none
INFO: kex: client->server aes128-cbc hmac-md5 none
INFO: SSH_MSG_KEXDH_INIT sent
INFO: expecting SSH_MSG_KEXDH_REPLY
INFO: ssh_rsa_verify: signature true
WARN: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
INFO: SSH_MSG_NEWKEYS sent
INFO: SSH_MSG_NEWKEYS received
INFO: SSH_MSG_SERVICE_REQUEST sent
INFO: SSH_MSG_SERVICE_ACCEPT received
INFO: Authentications that can continue: publickey,keyboard-interactive,password
INFO: Next authentication method: publickey
INFO: Authentications that can continue: keyboard-interactive,password
INFO: Next authentication method: keyboard-interactive
INFO: Authentications that can continue: password
INFO: Next authentication method: password
INFO: Authentication succeeded (password).
INFO: Caught an exception, leaving main loop due to End of IO Stream Read
INFO: Disconnecting from 127.0.0.1 port 22









share|improve this question
















I have made an SSH client with JSch. The client is working correctly with my Apache Mina SSH server. But when I test it with a real equipment, it fails.



This is the code of the client:



public boolean openConnection() throws ItsSshException {

boolean connectSuccess = false;
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
jschSSH.setConfig(config);
try {
sshSession = jschSSH.getSession(username, hostname, port);
sshSession.setPassword(password);
sshSession.connect(connectionTimeout);
LOGGER.info("Connection timeout : " + connectionTimeout);
Thread.sleep(1000);
sshHChannel = sshSession.openChannel("shell");
sshHChannel.connect();
in = sshHChannel.getInputStream();
out = new PrintStream(sshHChannel.getOutputStream());
clearInitialSocketState();
connectSuccess = true;
} catch (Exception e) {
LOGGER.error("Error during connecting to host: " + hostname +
", port: " + port + "!", e);
throw new ItsSshException("Error during connecting to host: " + e.getMessage());
}
LOGGER.info("connectSuccess : " + connectSuccess);
return connectSuccess;
}


The code is failing at this point:



sshHChannel = sshSession.openChannel("shell");



Error during connecting to host: 127.0.0.1, port: 22!

com.jcraft.jsch.JSchException: session is down

at com.jcraft.jsch.Session.openChannel(Session.java:861)




My question is how to fix this problem and what can make it to occure?



This is JSch log:



INFO: Connecting to 127.0.0.1 port 22 
INFO: Connection established
INFO: Remote version string: SSH-2.0-Mocana SSH
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: aes256-ctr is not available.
INFO: aes192-ctr is not available.
INFO: aes256-cbc is not available.
INFO: aes192-cbc is not available.
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: aes256-cbc,rijndael256-cbc,aes192-cbc,rijndael192-cbc,aes128-cbc,rijndael128-cbc,3des-cbc,arcfour
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-cbc hmac-md5 none
INFO: kex: client->server aes128-cbc hmac-md5 none
INFO: SSH_MSG_KEXDH_INIT sent
INFO: expecting SSH_MSG_KEXDH_REPLY
INFO: ssh_rsa_verify: signature true
WARN: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
INFO: SSH_MSG_NEWKEYS sent
INFO: SSH_MSG_NEWKEYS received
INFO: SSH_MSG_SERVICE_REQUEST sent
INFO: SSH_MSG_SERVICE_ACCEPT received
INFO: Authentications that can continue: publickey,keyboard-interactive,password
INFO: Next authentication method: publickey
INFO: Authentications that can continue: keyboard-interactive,password
INFO: Next authentication method: keyboard-interactive
INFO: Authentications that can continue: password
INFO: Next authentication method: password
INFO: Authentication succeeded (password).
INFO: Caught an exception, leaving main loop due to End of IO Stream Read
INFO: Disconnecting from 127.0.0.1 port 22






java shell ssh jsch






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '17 at 13:13









Martin Prikryl

92.5k22185391




92.5k22185391










asked Nov 21 '17 at 7:57









xmlParserxmlParser

668522




668522













  • The exception is in openChannel. On this row: sshHChannel = sshSession.openChannel("shell");

    – xmlParser
    Nov 21 '17 at 8:04











  • And btw about the seccond comment. I gave you reputation about the answer because it helped me at the first point. But my question then was more complicated and thats why it didnt helped me in the discusion.

    – xmlParser
    Nov 21 '17 at 8:06






  • 1





    Moreover, you are already using LOGGER.info, so why don't you use that?

    – Martin Prikryl
    Nov 21 '17 at 10:53






  • 1





    Is this your post? stackoverflow.com/q/47411185/850848

    – Martin Prikryl
    Nov 21 '17 at 11:19






  • 1





    Why do you have Thread.sleep(1000); there? + Can you add timestamps to the log? And include a log entry before the sshSession.openChannel("shell");?

    – Martin Prikryl
    Nov 21 '17 at 12:48



















  • The exception is in openChannel. On this row: sshHChannel = sshSession.openChannel("shell");

    – xmlParser
    Nov 21 '17 at 8:04











  • And btw about the seccond comment. I gave you reputation about the answer because it helped me at the first point. But my question then was more complicated and thats why it didnt helped me in the discusion.

    – xmlParser
    Nov 21 '17 at 8:06






  • 1





    Moreover, you are already using LOGGER.info, so why don't you use that?

    – Martin Prikryl
    Nov 21 '17 at 10:53






  • 1





    Is this your post? stackoverflow.com/q/47411185/850848

    – Martin Prikryl
    Nov 21 '17 at 11:19






  • 1





    Why do you have Thread.sleep(1000); there? + Can you add timestamps to the log? And include a log entry before the sshSession.openChannel("shell");?

    – Martin Prikryl
    Nov 21 '17 at 12:48

















The exception is in openChannel. On this row: sshHChannel = sshSession.openChannel("shell");

– xmlParser
Nov 21 '17 at 8:04





The exception is in openChannel. On this row: sshHChannel = sshSession.openChannel("shell");

– xmlParser
Nov 21 '17 at 8:04













And btw about the seccond comment. I gave you reputation about the answer because it helped me at the first point. But my question then was more complicated and thats why it didnt helped me in the discusion.

– xmlParser
Nov 21 '17 at 8:06





And btw about the seccond comment. I gave you reputation about the answer because it helped me at the first point. But my question then was more complicated and thats why it didnt helped me in the discusion.

– xmlParser
Nov 21 '17 at 8:06




1




1





Moreover, you are already using LOGGER.info, so why don't you use that?

– Martin Prikryl
Nov 21 '17 at 10:53





Moreover, you are already using LOGGER.info, so why don't you use that?

– Martin Prikryl
Nov 21 '17 at 10:53




1




1





Is this your post? stackoverflow.com/q/47411185/850848

– Martin Prikryl
Nov 21 '17 at 11:19





Is this your post? stackoverflow.com/q/47411185/850848

– Martin Prikryl
Nov 21 '17 at 11:19




1




1





Why do you have Thread.sleep(1000); there? + Can you add timestamps to the log? And include a log entry before the sshSession.openChannel("shell");?

– Martin Prikryl
Nov 21 '17 at 12:48





Why do you have Thread.sleep(1000); there? + Can you add timestamps to the log? And include a log entry before the sshSession.openChannel("shell");?

– Martin Prikryl
Nov 21 '17 at 12:48












2 Answers
2






active

oldest

votes


















1














Try to use:



Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications", "password");
jschSSH.setConfig(config);


and also set



sshSession.connect(connectionTimeout) to 5000 or more.


also as Martin said



remove Thread.sleep(1000);





share|improve this answer





















  • 1





    The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

    – Martin Prikryl
    Nov 21 '17 at 13:53











  • Thank you about the detailed answers!

    – xmlParser
    Nov 21 '17 at 14:17



















2














Remove this:



Thread.sleep(1000);


The server probably times out waiting for a request from the client (JSch) and aborts the connection.






share|improve this answer


























  • Thank you about the detailed answers! You helped me a lot.

    – xmlParser
    Nov 21 '17 at 14:20











  • So was any change from the answer by @Bambus needed?

    – Martin Prikryl
    Nov 21 '17 at 14:22











  • Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

    – xmlParser
    Nov 21 '17 at 14:26













  • And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

    – xmlParser
    Nov 21 '17 at 14:29











  • But you didn't have a problem with connection. It was the server that closed the connection.

    – Martin Prikryl
    Nov 21 '17 at 14:40












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47407943%2fsession-is-down-error-when-opening-an-ssh-channel-with-jsch%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Try to use:



Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications", "password");
jschSSH.setConfig(config);


and also set



sshSession.connect(connectionTimeout) to 5000 or more.


also as Martin said



remove Thread.sleep(1000);





share|improve this answer





















  • 1





    The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

    – Martin Prikryl
    Nov 21 '17 at 13:53











  • Thank you about the detailed answers!

    – xmlParser
    Nov 21 '17 at 14:17
















1














Try to use:



Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications", "password");
jschSSH.setConfig(config);


and also set



sshSession.connect(connectionTimeout) to 5000 or more.


also as Martin said



remove Thread.sleep(1000);





share|improve this answer





















  • 1





    The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

    – Martin Prikryl
    Nov 21 '17 at 13:53











  • Thank you about the detailed answers!

    – xmlParser
    Nov 21 '17 at 14:17














1












1








1







Try to use:



Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications", "password");
jschSSH.setConfig(config);


and also set



sshSession.connect(connectionTimeout) to 5000 or more.


also as Martin said



remove Thread.sleep(1000);





share|improve this answer















Try to use:



Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications", "password");
jschSSH.setConfig(config);


and also set



sshSession.connect(connectionTimeout) to 5000 or more.


also as Martin said



remove Thread.sleep(1000);






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '17 at 14:32

























answered Nov 21 '17 at 13:38









BambusBambus

810619




810619








  • 1





    The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

    – Martin Prikryl
    Nov 21 '17 at 13:53











  • Thank you about the detailed answers!

    – xmlParser
    Nov 21 '17 at 14:17














  • 1





    The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

    – Martin Prikryl
    Nov 21 '17 at 13:53











  • Thank you about the detailed answers!

    – xmlParser
    Nov 21 '17 at 14:17








1




1





The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

– Martin Prikryl
Nov 21 '17 at 13:53





The authentication has succeeded, so setting PreferredAuthentications cannot help. + Do not ever recommend anyone to use StrictHostKeyChecking=no without explaining the consequences.

– Martin Prikryl
Nov 21 '17 at 13:53













Thank you about the detailed answers!

– xmlParser
Nov 21 '17 at 14:17





Thank you about the detailed answers!

– xmlParser
Nov 21 '17 at 14:17













2














Remove this:



Thread.sleep(1000);


The server probably times out waiting for a request from the client (JSch) and aborts the connection.






share|improve this answer


























  • Thank you about the detailed answers! You helped me a lot.

    – xmlParser
    Nov 21 '17 at 14:20











  • So was any change from the answer by @Bambus needed?

    – Martin Prikryl
    Nov 21 '17 at 14:22











  • Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

    – xmlParser
    Nov 21 '17 at 14:26













  • And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

    – xmlParser
    Nov 21 '17 at 14:29











  • But you didn't have a problem with connection. It was the server that closed the connection.

    – Martin Prikryl
    Nov 21 '17 at 14:40
















2














Remove this:



Thread.sleep(1000);


The server probably times out waiting for a request from the client (JSch) and aborts the connection.






share|improve this answer


























  • Thank you about the detailed answers! You helped me a lot.

    – xmlParser
    Nov 21 '17 at 14:20











  • So was any change from the answer by @Bambus needed?

    – Martin Prikryl
    Nov 21 '17 at 14:22











  • Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

    – xmlParser
    Nov 21 '17 at 14:26













  • And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

    – xmlParser
    Nov 21 '17 at 14:29











  • But you didn't have a problem with connection. It was the server that closed the connection.

    – Martin Prikryl
    Nov 21 '17 at 14:40














2












2








2







Remove this:



Thread.sleep(1000);


The server probably times out waiting for a request from the client (JSch) and aborts the connection.






share|improve this answer















Remove this:



Thread.sleep(1000);


The server probably times out waiting for a request from the client (JSch) and aborts the connection.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '17 at 14:16

























answered Nov 21 '17 at 13:11









Martin PrikrylMartin Prikryl

92.5k22185391




92.5k22185391













  • Thank you about the detailed answers! You helped me a lot.

    – xmlParser
    Nov 21 '17 at 14:20











  • So was any change from the answer by @Bambus needed?

    – Martin Prikryl
    Nov 21 '17 at 14:22











  • Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

    – xmlParser
    Nov 21 '17 at 14:26













  • And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

    – xmlParser
    Nov 21 '17 at 14:29











  • But you didn't have a problem with connection. It was the server that closed the connection.

    – Martin Prikryl
    Nov 21 '17 at 14:40



















  • Thank you about the detailed answers! You helped me a lot.

    – xmlParser
    Nov 21 '17 at 14:20











  • So was any change from the answer by @Bambus needed?

    – Martin Prikryl
    Nov 21 '17 at 14:22











  • Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

    – xmlParser
    Nov 21 '17 at 14:26













  • And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

    – xmlParser
    Nov 21 '17 at 14:29











  • But you didn't have a problem with connection. It was the server that closed the connection.

    – Martin Prikryl
    Nov 21 '17 at 14:40

















Thank you about the detailed answers! You helped me a lot.

– xmlParser
Nov 21 '17 at 14:20





Thank you about the detailed answers! You helped me a lot.

– xmlParser
Nov 21 '17 at 14:20













So was any change from the answer by @Bambus needed?

– Martin Prikryl
Nov 21 '17 at 14:22





So was any change from the answer by @Bambus needed?

– Martin Prikryl
Nov 21 '17 at 14:22













Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

– xmlParser
Nov 21 '17 at 14:26







Yeah, my connectionTImeout was 500 but i didnt noticed that that could be a problem...

– xmlParser
Nov 21 '17 at 14:26















And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

– xmlParser
Nov 21 '17 at 14:29





And why i cant mark your question as solved? That is needed too... Only one answer can be marked as solved?

– xmlParser
Nov 21 '17 at 14:29













But you didn't have a problem with connection. It was the server that closed the connection.

– Martin Prikryl
Nov 21 '17 at 14:40





But you didn't have a problem with connection. It was the server that closed the connection.

– Martin Prikryl
Nov 21 '17 at 14:40


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47407943%2fsession-is-down-error-when-opening-an-ssh-channel-with-jsch%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?