jsch


com.jcraft.jsch.JSchException: failed to send sftp request


WinSCP based same connection using account name, passphrase and private key for connection. But trying from code am getting this exception continuously.
Code:
try
{
session.connect();
System.out.println("session is alive:" + session.isConnected());
channel = session.openChannel("sftp");
channel.connect();
channelSftp = (ChannelSftp) channel;
channelSftp.connect();
channelSftp.chmod(777, depDir);
}
catch (Exception e1)
{
e1.printStackTrace();
System.out.println("Manual Exception in updateDepositedFilePermission:" + CommonUtil.getExceptionString(e1));
}
Output:
session is alive:true
Manual Exception in updateDepositedFilePermission:com.jcraft.jsch.JSchException: failed to send sftp request
at com.jcraft.jsch.RequestSftp.request(Unknown Source)
at com.jcraft.jsch.ChannelSftp.start(Unknown Source)
at com.jcraft.jsch.Channel.connect(Unknown Source)
at com.app.sftp.CheckFTP.main(CheckFTP.java:730)
session is alive:true
com.jcraft.jsch.JSchException: failed to send sftp request
at com.jcraft.jsch.RequestSftp.request(Unknown Source)
at com.jcraft.jsch.ChannelSftp.start(Unknown Source)
at com.jcraft.jsch.Channel.connect(Unknown Source)
at com.app.sftp.CheckFTP.main(CheckFTP.java:730)
Not sure it's the main problem, but you are calling Channel.connect() twice.
First here:
channel.connect();
And again here:
channelSftp.connect();
Remove the second call.

Related Links

How to get one stream from error stream and input stream when calling a script using JSCH
SFTP using jschexception verify false sometimes fails
how to increase the jsch buffer size?
The cipher 'aes256-cbc' is required, but it is not available
How to pause/resume procedure while/after upload file by ChannelSftp
jsch + running multiple command in shell after SU and then close channal
NGit/Nsch Generating SSH Keypair (c# Jgit)
Extract userInfo from JSCH stream
Running a Shell Script using java ( process Builder ) with a specific unix user
Java jsch and resuming file upload after interruption?
How to pass a variable through channel in Jsch?
How to handle passwords prompts in expectj
Retaining the last modified date while using ChannelSftp for file transfer
Is there a limit to how many channels can be open per session in JSch?
How to read JSch command output?
What could cause a thread that is receiving output from a JSch channel to hang while printing that output

Categories

HOME
variables
atom-editor
keras
zeromq
image-processing
deezer
google-play
relay
routes
setup-deployment
baqend
alpha
reveal.js
remote-access
solaris-10
http-status-code-504
flux
nodatime
xlsxwriter
java-3d
mustache.php
traffic
web-api-testing
applozic
file-rename
gsoap
google-sites-2016
windows-dev-center
geopositioning
wallpaper
picasso
fusionpbx
devextreme
vxworks
hilbert-curve
password-encryption
angular-resource
menuitem
jedis
promela
tizen-native-app
rdfs
togetherjs
git-diff
yii2-extension
ifs
spring-mongodb
setuptools
url-pattern
color-picker
ado.net-entity-data-model
livequery
ipconfig
phpcas
freedesktop.org
wso2cloud
lemon
eclipse-clp
tarjans-algorithm
wyam
operation
npapi
xojo
aapt
navigationservice
fluentautomation
mbr
stxxl
page-layout
html4
sqlperformance
dmoz
pendrive
mercurial-server
libc++
coredump
locationlistener
pyinotify
w3wp.exe
cxxtest
sudzc
gallio
sef
xetex
phonon
dbisam

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App