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

java jsch -executing multiple unix commands
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?

Categories

HOME
clips
listview
c#-4.0
google-play
angular-material
hashmap
gis
append
kentor-authservices
quicklook
u-sql
dtrace
designer
uitypeeditor
ghc
transformation
finite-automata
pugjs
amazonsellercentral
telerik-reporting
su
status
entitlements
react-chartjs
normal-distribution
file-format
serve
serverside-rendering
c11
vapor
leading-zero
eclipse-scout
sql-server-agent
spring-security-kerberos
password-encryption
arena-simulation
no-www
.net-4.6.2
sencha-touch-2.3
auto-update
rainbowtable
parentheses
paxos
python-webbrowser
dropbox-php
forever
csound
sqlclient
qtwebview
cudafy.net
spring-cache
query-performance
objective-c-swift-bridge
wdf
url-pattern
angular-cache
heidisql
instant
bonobo
home-directory
react-native-listview
qcustomplot
qgraphicsview
bgp
hexdump
php-parse-error
wso2cloud
jms2
cartesian-product
apache-commons-fileupload
directoryservices
asp.net-dynamic-data
android-nested-fragment
java-metro-framework
device-manager
googlemock
elliptic-curve
jquery-layout
android-2.2-froyo
stxxl
c18
access-rights
seed
random-seed
typoscript2
chuck
fireworks
mercurial-server
window-management
heartbeat
tomcat-valve
cinema-4d
radcombobox
ncqrs
multi-tier
mdac
document-conversion

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App