Hi all,
I try vainly to use VFS to connect to SFTP server .
I do the same as explained on
http://wiki.apache.org/commons/SimpleSftpFileDownload wiki page
here a snippet code
FileSystemManager fsManager = VFS.getManager();
UserAuthenticator auth = new StaticUserAuthenticator(null,
"login","passwd");
FileSystemOptions ops = new FileSystemOptions();
try {
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(ops,auth);
}
catch (FileSystemException ex) {
throw new RuntimeException("setUserAuthenticator failed", ex);
}
FileObject fss = fsManager.resolveFile("sftp://x.x.x.x/export/home/",ops);
I get the exception:
Exception in thread "main" org.apache.commons.vfs.FileSystemException: Could
not connect to SFTP server at "sftp://x.x.x.x/".
at
org.apache.commons.vfs.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:99)
at
org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
at
org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:62)
at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:641)
at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:582)
at com.fimat.kb.util.ftp.FTPManager.main(FTPManager.java:181)
Caused by: org.apache.commons.vfs.FileSystemException: Could not connect to
SFTP server at "x.x.x.x".
at
org.apache.commons.vfs.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:214)
at
org.apache.commons.vfs.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:90)
... 5 more
Caused by: com.jcraft.jsch.JSchException: UnknownHostKey: x.x.x.x
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:210)
... 6 more
best regards!
--
View this message in context:
http://www.nabble.com/-VFS--SFTP--cannot-connect-to-SFT-server-tp21011512p21011512.html
Sent from the Commons - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]