If I get this correctly, you've got a Java client connecting to the ssh
server on the unix box and using that connection to execute a script on
the server and it is the script that is supposed to be closing the
connection?
I'm (very, very) far from an expert here, but I've jut been mucking
around with crafting a wrapper around jsch to do sftp and it would seem
to me that it's the client's responsibility to close the connection to
the server it opened and that the script probably can't as it didn't
open the channel (and probably has no idea how to address the channel to
close it).
If the client knows when/if the script is done, or reaches a time-out
threshold, then it can close the connection (with Session.disconnect
assuming it is a Session that was connected).
~~~~~~~~~~~~~~~~~~~~~~~
Joe Magid
Senior Developer
ING - Retail Annuity IT Production Support
________________________________
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, November 16, 2010 04:10 AM
To: [email protected]
Cc: [email protected]
Subject: [JSch-users] FW: Oracle exp command with jsch
(Resending for the group)..
Hi Alan,
Thanks for the reply.
Yes, I am reading both output and error channel. I have run the
following commands in the server and both print fine, i.e., all the
characters are printed. Moreover i could observe in the code that the
input buffer has no content in it AND the channel is never closed.
Please note my source code below which is just exactly as suggested in
the example files.
StringBuilder tmpBuf = new StringBuilder();
byte[] tmp = new byte[1024];
while (true) {
while (in.available() > 0) {
int i = in.read(tmp, 0, 1024);
if (i < 0)
break;
String resp = new String(tmp, 0, i);
tmpBuf.append(resp);
}
if (channel.isClosed()) {
in.close();
break;
}
//for debug, if miss isClosed()
if( !channel.isClosed() && channel.getExitStatus() == 0 ){
System.out.println("before close exit-status changed!" );
}
}
Here, the inputstream 'in', after few cycles, is returning no character
(in.available < 0) and channel.isClosed() is never true.
Please advise.
Regards,
P.V.R.Kartik
________________________________
From: Keith Alan Richardson [mailto:[email protected]]
Sent: Tuesday, November 16, 2010 1:14 PM
To: Kartik Pullabhotla v r (WT01 - GMT-Telecom Equipment)
Cc: [email protected]
Subject: Re: [JSch-users] Oracle exp command with jsch
Are you reading the channel stdout and stderr? One or both buffers may
fill up causing deadlock
SQL*Plus may not produce enough output to fill the buffers but exp
might.
You can test if this is your problem by running the following commands :
# print 1MB to stdout
perl -e 'print "x"x(1*1024*1024)'
# print 1MB to sterr
perl -e 'print STDERR "x"x(1*1024*1024)'
On 16 Nov 2010 09:00, <[email protected]> wrote:
(Resending this since i haven't received any acknowlegement or
the copy)
Hi Team,
We have a project here whose primary purpose is to call a script
on a unix server from...
------------------------------------------------------------------------
------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 &
L3.
Spend less time writing and rewriting code and more time
creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users
---------------------------------------------------------
NOTICE: The information contained in this electronic mail message is
confidential and intended only for certain recipients. If you are not an
intended recipient, you are hereby notified that any disclosure, reproduction,
distribution or other use of this communication and any attachments is strictly
prohibited. If you have received this communication in error, please notify
the sender by reply transmission and delete the message without copying or
disclosing it.
============================================================================================
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users