commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manco <megust...@yahoo.com>
Subject commons vfs - Could not connect to SFTP server
Date Fri, 22 Apr 2005 23:30:58 GMT
Hi,
 
I am trying to see if I can use commons-vfs combined with JSch to connect to my
SFTP server.
 
I am using the test program from apache to verify operation before I invest too much time
: public class ShowProperties
which take a uri as a command line param and just diplays stats about the file
 
I can use an ftp uri with no problems:
ftp://userX:password@hostname/home/pipe3/filename.log
/* .... */
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.FileType;
import org.apache.commons.vfs.VFS;
import java.text.DateFormat;
import java.util.Date;
import org.apache.log4j.*;
 
public class ShowProperties
{
  private static Logger logger = Logger.getLogger( ShowProperties.class );
    public static void main(String[] args)
{ 
  ...
                FileSystemManager mgr = VFS.getManager();
                System.out.println();
                System.out.println("Parsing: " + args[i]);
                FileObject file = mgr.resolveFile(args[i]);  <----- the sftp blowup here!
...
}
I get lots of  ... "Skiping because required class not found", but I added the JSch.jar and
this
eliminated the skipping msg for SFTP.
 
The following is the GOOD output from the  ftp run:
 
Parsing: ftp://userX:password@hostname/home/pipe3/filename.log
URL: ftp://userX:password@hostname/home/pipe3/filename.log
getName(): ftp://userX:password@hostname/home/pipe3/filename.log
BaseName: filename.log
Extension: log
Path: /home/pipe3/filename.log
Scheme: ftp
URI: ftp://userX:password@hostname/home/pipe3/filename.log
Root URI: ftp://userX:password@hostname/
Parent: ftp://userX:password@hostname/home/pipe3
Type: file
Exists: true
Readable: true
Writeable: true
Root path: /
Size: 1947 bytes
Last modified: 4/19/05 11:52 PM
 
The problem is when I attempt to use the SFTP, I have no problem connecting to this
host via my SSH client and with the Secure File Transfer Client.
 
I'm guessing its my uri or some other setup, any help would be appreciated,
 
Thanks,
Manco
 
ERROR Output:
 
Parsing: sftp://userX:password@hostname/home/pipe3/filename.log
 
org.apache.commons.vfs.FileSystemException: Could not connect to SFTP server at "sftp://userX:password@hostname/".
 at org.apache.commons.vfs.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:86)
 at org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:76)
 at org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:61)
 at org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:505)
 at org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:483)
 at org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:453)
 at com.eMeter.vfstest.ShowProperties.main(ShowProperties.java:67)
Caused by: org.apache.commons.vfs.FileSystemException: Could not connect to SFTP server at
"linuxserver1".
 at org.apache.commons.vfs.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:142)
 at org.apache.commons.vfs.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:78)
 ... 6 more
Caused by: com.jcraft.jsch.JSchException: UnknownHostKey
 at com.jcraft.jsch.Session.checkHost(Unknown Source)
 at com.jcraft.jsch.Session.connect(Unknown Source)
 at com.jcraft.jsch.Session.connect(Unknown Source)
 at org.apache.commons.vfs.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:138)
 ... 7 more
 
 
 
libs being used
jsch-0.1.20
jakarta-oro-2.0.8.jar
commons-net-1.3.0.jar
commons-vfs.jar  

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message