Nicolas Kukolja | 19 Feb 13:07 2014
Picon

Problem transferring files larger than 4GB via SFTP

Hi,
 
I am implementing a java application that transfers (large) files to an ftp-server, using sftp (JSch).
 
Everything works fine so far with small files. But if a file is larger, the transfer hangs always at about 4GB - 4,1GB and doesn't move on.
After 10 minutes, I get an "java.io.IOException: Pipe closed". The "rekey"-Param (http://www.proftpd.org/docs/contrib/mod_sftp.html#SFTPRekey) of the server is configured to 500MB, and the key exchange seems to work fine, as the server log tells me.
 
Does anyone have a suggestion, what I am doing wrong?
If you need any more information, please give me a hint...
 
Kind regards,
Nicolas
 
 
 
Environment:
Client:
- Windows 2008 Server
- Java 1.6.0_45 x64
- Java application using JSch 0.1.50.jar
 
Server:
- Solaris 10
- FTP-Server: http://www.proftpd.org
 
 
 
My connect-method:
   public boolean connect( Long orderId )
   {
      try
      {
         this.jSch = new JSch();
         logger.info( "[Order:" + orderId + "] Connecting to SFTP-Server: " + this.username + ":" + this.password + " <at> " + this.host + ":" + this.port );
         // create session
         this.sftpSession = this.jSch.getSession( this.username, this.host, this.port );
         // build config
         Hashtable<String,String> config = new Hashtable<String,String>();
         config.put( "StrictHostKeyChecking", "no" );
         this.sftpSession.setConfig( config );
         this.sftpSession.setPassword( this.password );
         // establish connection
         this.sftpSession.connect();
         this.sftpChannel = ( ChannelSftp ) this.sftpSession.openChannel( "sftp" );
         this.sftpChannel.connect();
         logger.info( "[Order:" + orderId + "] Current directory on SFTP-Server (pwd): " + this.sftpChannel.pwd() );
         if( this.ftpSubdir != null && this.ftpSubdir.length() > 0 )
         {
            logger.info( "[Order:" + orderId + "] Changing to subdirectory on SFTP-Server (cd): " + this.ftpSubdir );
            this.sftpChannel.cd( this.ftpSubdir );
            logger.info( "[Order:" + orderId + "] Current directory on SFTP-Server (pwd): " + this.sftpChannel.pwd() );
         }
      }
      catch( JSchException e )
      {
         logger.error( "[Order:" + orderId + "] Error connecting to SFTP-Server... (uri: '" + this.sftpUri + "')", e );
         return false;
      }
      catch( SftpException e )
      {
         logger.error( "[Order:" + orderId + "] Error connecting to SFTP-Server... (uri: '" + this.sftpUri + "')", e );
         return false;
      }
      return this.sftpChannel.isConnected();
   }
 
My upload-method:
   public void uploadSynchronized( String source, String target, Long filesize, Long orderId )
   {
      long overallFilesize = filesize == null ? 0 : filesize;
      long overallUploadedBytes = 0;
      long uploadedBytes = 0;
      try
      {
         if( !checkIfFileExists( source ) )
         {
            OutputStream tOut = this.sftpChannel.put( target );
            FileInputStream in = new FileInputStream( source );
            byte[] bytes = new byte[ this.chunkSize ];
            int count = in.read( bytes );
            try
            {
               while( count != -1 && count <= this.chunkSize && !this.abort )
               {
                  tOut.write( bytes, 0, count );
                  uploadedBytes = uploadedBytes + this.chunkSize;
                  if( uploadedBytes >= BYTES_TO_LOG )
                  {
                     overallUploadedBytes = overallUploadedBytes + uploadedBytes;
                     uploadedBytes = 0;
                     logger.info( "[Order:" + orderId + "] " + overallUploadedBytes / MEGA_BYTE + "MB of " + overallFilesize / MEGA_BYTE
                           + "MB uploaded (source: '" + source + "', target: '" + target + "')" );
                  }
                  count = in.read( bytes );
               }
            }
            finally
            {
               in.close();
               tOut.close();
            }
         }
         else
         {
            this.success = false;
            logger.error( "[Order:" + orderId + "] Error uploading file... (source: '" + source + "', target: '" + target
                  + "'): File already exists on SFTP-Server" );
         }
      }
      catch( IOException e )
      {
         this.success = false;
         logger.error( "[Order:" + orderId + "] Error uploading file... (source: '" + source + "', target: '" + target + "')", e );
      }
      catch( SftpException e )
      {
         this.success = false;
         logger.error( "[Order:" + orderId + "] Error uploading file... (source: '" + source + "', target: '" + target + "')", e );
      }
      catch( Exception e )
      {
         this.success = false;
         logger.error( "[Order:" + orderId + "] Error uploading file... (source: '" + source + "', target: '" + target + "')", e );
      }
   }
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
Prakash Babu | 10 Feb 07:24 2014
Picon

jsch session connect waits indefinitely

Hi,


I am using JSCH 0.1.44 and trying to execute a remote command on a Solaris Host and the
session.connect() waits indefinitely.

JSch jsch = new JSch();
Session session = jsch.getSession(m_user, m_host, m_port);
session.connect(60000)


Jstack thread dump shows the following stack trace

java.lang.Thread.State: RUNNABLE
 at java.util.WeakHashMap.get(WeakHashMap.java:355)
 at javax.crypto.SunJCE_b.a(DashoA13*..)
 at javax.crypto.SunJCE_h.a(DashoA13*..)
 at javax.crypto.Cipher.c(DashoA13*..)
 at javax.crypto.Cipher.b(DashoA13*..)
 at javax.crypto.Cipher.a(DashoA13*..)
 - locked <0x0000000788198fd8> (a java.lang.Object)
 at javax.crypto.Cipher.init(DashoA13*..)
 at javax.crypto.Cipher.init(DashoA13*..)
 at com.jcraft.jsch.jce.ARCFOUR.init(ARCFOUR.java:54)
 at com.jcraft.jsch.Session.checkCipher(Session.java:1947)
 at com.jcraft.jsch.Session.checkCiphers(Session.java:1924)
 at com.jcraft.jsch.Session.send_kexinit(Session.java:562)
 at com.jcraft.jsch.Session.connect(Session.java:278)               
 
What could be the possible causes for this connect issue.
Any debug statements I can add to triage this issue ?
 
thanks,
Prakash
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
Andy Yang | 28 Jan 17:01 2014
Picon

Lifecycle of Sessions and SftpChannels

Hi,

A general question that isn't obvious to me from scanning the available sample code:

What is the convention for connecting/disconnecting Channels and Sessions? I got the impression that sessions and channels could be long-lived, but testing my code is suggesting that this might be a mistake.

As a simple example, if I want to download a list of files, should it be (in sort-of-pseudo-code):

        session = jsch.getSession(userId, server, 22);
        session.connect();
        ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
        channel.connect();

        for (String fname : fileList) {
            channel.get(fname, destPath);
        }

        channel.disconnect();
        session.disconnect();

Or should it be:

        session = jsch.getSession(userId, server, 22);
        session.connect();

        for (String fname : fileList) {
            ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
            channel.connect();
            channel.get(fname, destPath);
            channel.disconnect();
        }
        session.disconnect();

And should I be using setServerAliveInterval() and setDaemonThread() on the session?

I'm finding that my initial approach of keeping a single session and a single sftp channel over multiple operations results in intermittent 'inputstream closed' and 'pipe closed' errors.

Thanks,
Andy

   
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
Ravi Joshi | 12 Jan 18:16 2014
Picon

What are the ways to speed up JSch

Hi,

I am using JSch v0.1.50 for following three functions-
(1) Copy file from local to remote machine
(2) Copy file from remote to local machine
(3) Execute command on remote machine

I am following ScpTo.java (http://www.jcraft.com/jsch/examples/ScpTo.java.html), ScpFrom.java (http://www.jcraft.com/jsch/examples/ScpFrom.java.html) and Exec.java (http://www.jcraft.com/jsch/examples/Exec.java.html) respectively for above functionalities.

In my implementation, I have com.jcraft.jsch.Session object as a class variable which is being reused every time. I have following two questions-

(1) Why Exec.java has an an implicit sleep (line no. 84)? Can I remove/reduce this sleep?
(2) What are the ways to speed up JSch in these scenarios?


-
Thanks
Ravi

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
salman khattak | 8 Jan 15:22 2014
Picon

"WARNING: Your password has expired" keeps coming back

We are experiencing a weird situation.
Here is the relevant log when we SSH using JSch 1.5 to SCO OpenServer(TM) Release 6.0.0

==================
SessionFactory.makeObject()
Connecting to xxxxxx.xxxxxxxx.xxx port 22
Connection established
Remote version string: SSH-2.0-OpenSSH_4.6
Local version string: SSH-2.0-JSCH-0.1.50
CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
aes256-ctr is not available.
aes192-ctr is not available.
aes256-cbc is not available.
aes192-cbc is not available.
arcfour256 is not available.
CheckKexes: diffie-hellman-group14-sha1
diffie-hellman-group14-sha1 is not available.
SSH_MSG_KEXINIT sent
SSH_MSG_KEXINIT received
kex: server: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
kex: server: ssh-rsa,ssh-dss
kex: server: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc-SamgB31n2u5IcsJQ0EH25Q@public.gmane.org,aes128-ctr,aes192-ctr,aes256-ctr
kex: server: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc-SamgB31n2u5IcsJQ0EH25Q@public.gmane.org,aes128-ctr,aes192-ctr,aes256-ctr
kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160-ZT/51Pfwho1BDgjK7y7TUQ@public.gmane.org,hmac-sha1-96,hmac-md5-96
kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160-ZT/51Pfwho1BDgjK7y7TUQ@public.gmane.org,hmac-sha1-96,hmac-md5-96
kex: server: none,zlib-ZT/51Pfwho1BDgjK7y7TUQ@public.gmane.org,zlib
kex: server: none,zlib <at> openssh.com,zlib
kex: server:
kex: server:
kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
kex: client: ssh-rsa,ssh-dss
kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
kex: client: none
kex: client: none
kex: client:
kex: client:
kex: server->client aes128-ctr hmac-md5 none
kex: client->server aes128-ctr hmac-md5 none
SSH_MSG_KEXDH_INIT sent
expecting SSH_MSG_KEXDH_REPLY
ssh_rsa_verify: signature true
Permanently added 'xxxxx.xxxxxx.xxx' (RSA) to the list of known hosts.
SSH_MSG_NEWKEYS sent
SSH_MSG_NEWKEYS received
SSH_MSG_SERVICE_REQUEST sent
SSH_MSG_SERVICE_ACCEPT received
Authentications that can continue: publickey,keyboard-interactive,password
Next authentication method: publickey
Authentications that can continue: password
Next authentication method: password
Authentication succeeded (password).
SessionFactory.makeObject() exit
WARNING: Your password has expired.
Password change required but no TTY available.
alResponse[null]
=========================================================================================

Notice the second to last line. "Password change required but no TTY available."

We reset the password. Try again. It works the first time but the warning reappears immediately afterwords.
We noticed that the shadow password file gets deleted on the server after first login resulting in the warning on subsequent attempts.
We are using Jakarta Commons Pooling to create a pool of JSch sessions. Logs for SessionFactory.makeObject() refers to the pool access.

Ideas anyone? We are also in the process of contacting SCO Unix support in the meanwhile.
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
Steve Anderson | 7 Jan 02:12 2014
Picon

Ant sshexec task error when using key

Using ant 1.8.3, with jsch 0.1.50, when I try to use a key, I get the following error:

build.xml:34: com.jcraft.jsch.JSchException: privatekey: aes128-cbc is not available [B <at> 632dde87
    at com.jcraft.jsch.KeyPair.load(KeyPair.java:663)
    at com.jcraft.jsch.KeyPair.load(KeyPair.java:542)
    at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
    at com.jcraft.jsch.JSch.addIdentity(JSch.java:389)
    at com.jcraft.jsch.JSch.addIdentity(JSch.java:349)
    at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:212)
    at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:236)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.Main.runBuild(Main.java:851)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

I have verified my local JRE (1.7) policy allows all encryptions.  I can use the key for connecting via ssh at the command line.  I can also use the UserAuthPubKey example included in jsch to connect.

Any ideas?

     Steve
--
steve.anderson at gmail.com
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
Kishor.Golapelliwar | 29 Dec 11:31 2013

AUTO: Kishor Golapelliwar is out of the office (returning 02-01-2014)


I am out of the office until 02-01-2014.

I am on Personal leave from 24-11-2013  to 02-01-2014.
Anjali Chaurasia will be handling all request for above mentioned duration.
I wont be able to access mails and will have limited connectivity over
phone.
Please drop a message in case of emergency.

Note: This is an automated response to your message  "JSch-users Digest,
Vol 88, Issue 1" sent on 12/29/2013 3:17:40 PM.

This is the only notification you will receive while this person is away.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
Ravi Joshi | 29 Dec 10:47 2013
Picon

How to set ChannelExec error stream from System.err to log4j

Hi,

I want to execute a command to remote linux machine. I am referring Exec.java (http://www.jcraft.com/jsch/examples/Exec.java.html) example code.

I just wanted to know How to set ChannelExec error stream from System.err to log4j, so that all of these errors, I can get captured by log4j under error catagory.


-
Thanks
Ravi

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@...
https://lists.sourceforge.net/lists/listinfo/jsch-users
A Yang | 12 Dec 23:21 2013
Picon

Session.connect(): Connection refused

Hi,

I'm looking for some advice on how I would troubleshoot the following exception: 

The code in question runs properly on an Ubuntu development workstation, and I am able to connect via the
sftp cilent on the deployment environment (Red Hat). However, executing the code on Red Hat results in the
'Connection refused' error. I can also telnet to the remote SFTP server on port 22 from the deployment box.

com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused
	at com.jcraft.jsch.Util.createSocket(Util.java:389)
	at com.jcraft.jsch.Session.connect(Session.java:215)
	at com.jcraft.jsch.Session.connect(Session.java:183)
	at com.xyz.sftp.SFTPService.connect(SFTPService.java:107)
	at com.xyz.sftp.SFTPService.init(SFTPService.java:46)
	at com.xyz.sftp.SFTPUtility.init(SFTPUtility.java:44)
	at com.xyz.sftp.SFTPUtility.run(SFTPUtility.java:50)
	at com.xyz.sftp.SFTPUtility.execute(SFTPUtility.java:67)
	at com.xyz.sftp.SFTPUtility.main(SFTPUtility.java:44)
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException: Connection refused
	at com.xyz.sftp.SFTPService.init(SFTPService.java:50)
	at com.xyz.sftp.SFTPUtility.init(SFTPUtility.java:44)
	at com.xyz.sftp.SFTPUtility.run(SFTPUtility.java:50)
	at com.xyz.sftp.SFTPUtility.execute(SFTPUtility.java:67)
	at com.xyz.sftp.SFTPUtility.main(SFTPUtility.java:44)
Caused by: com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused
	at com.jcraft.jsch.Util.createSocket(Util.java:389)
	at com.jcraft.jsch.Session.connect(Session.java:215)
	at com.jcraft.jsch.Session.connect(Session.java:183)
	at com.xyz.sftp.SFTPService.connect(SFTPService.java:107)
	at com.xyz.sftp.SFTPService.init(SFTPService.java:46)
	... 4 more

As part of the init process, I load a known_hosts file and a private key from file:

public void init() {
        try {
            loadKnownHosts();

            byte[] privateKey = readPrivateKeyFromFile(_keyFileName);
            addIdentity(_userId, privateKey, _passPhrase.getBytes());
            connect(_server, _userId);
        }
        catch(Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }

    protected void connect(String server, String userId) throws JSchException {
        _session = _jsch.getSession(userId, server, 22);
        _session.setDaemonThread(true);
        _session.setServerAliveInterval(5000); // keep alive messages
        _session.connect();  // ***** EXCEPTION OCCURS ON THIS LINE
        Channel channel = _session.openChannel("sftp");
        _sftpChannel = (ChannelSftp) channel;
        _sftpChannel.connect();
    }

I can confirm that the private key is loaded properly, but I can't really tell if my known_hosts file is
causing the problem. Could an invalid known_hosts file result in a 'Connection refused' error?

Thanks for your time

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
Ettore | 3 Dec 10:32 2013
Picon

Jsch with PK auth - Execute commands without login - Account SU only

Hi everyone,

I'm facing a challenge regarding the use of JSCH.

When the account I'm trying to connect to via the PK auth mechanism, has the 
restriction SU only, I can only execute commands and not log onto the box.

As far as I know, through JSCH API I do have to connect first to the box and 
then I can execute commands, which as I mentioned above it is forbidden in my 
case.

Is there a way in JSCH to achieve the "ssh userName <at> hostName shellCommand" 
without having first issue "ssh userName <at> hostName" namely the connect method, 
and then at the prompt shell:command ?

Thank you in advance.

Regards.

Linux RH E.E. 5 32bits

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
Gerry Reno | 29 Nov 20:12 2013
Picon
Picon

ipv6: UnknownHostException on valid link-local address

Can someone provided me with a few pointers on getting ipv6 addresses working with JSch?

I'm starting off with link-local address (fe80::)

The target machine has this ipv6 address:  fe80::218:f8ff:fe0b:554b%eth0

So I've tried to connect using both:  fe80::218:f8ff:fe0b:554b  and  fe80::218:f8ff:fe0b:554b%eth0 
(with and without
the scope id / inf)

What I end up with is the following errors:

    ERROR: com.jcraft.jsch.JSchException java.net.ConnectException: failed to connect to
/fe80::218:f8ff:fe0b:554b (port
    22): connect failed: EINVAL (Invalid argument)

    ERROR: com.jcraft.jsch.JSchException java.net.UnknownHostException: Unable to resolve host
    "fe80::218:f8ff:fe0b:554b%eth0": No address associated with hostname

I am able to ping6 the address%inf:

    $ ping6 fe80::218:f8ff:fe0b:554b%eth0
    PING fe80::218:f8ff:fe0b:554b%eth0(fe80::218:f8ff:fe0b:554b) 56 data bytes
    64 bytes from fe80::218:f8ff:fe0b:554b: icmp_seq=1 ttl=64 time=0.380 ms
    64 bytes from fe80::218:f8ff:fe0b:554b: icmp_seq=2 ttl=64 time=0.233 ms
    64 bytes from fe80::218:f8ff:fe0b:554b: icmp_seq=3 ttl=64 time=0.284 ms

I am also able to login using openssh from the command line:

    $ ssh xxxxxxxx <at> fe80::218:f8ff:fe0b:554b%eth0
    Last login: Fri Nov 29 14:00:42 2013 from fe80::a2e:5fff:fe74:9e8d%eth0
    $

But I have not been able to figure a way to get JSch to connect successfully using ipv6.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk

Gmane