commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <>
Subject Re: [VFS] Could not connect to SFTP server
Date Sat, 23 Apr 2005 05:22:26 GMT
Hi manco!
>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(
> ... 7 more
The host is new for jsch or your ssh environment (known_hosts), so you 
have to trust it or pass the path to your known_hosts file to jasch

1) known_hosts
SftpFileSystemConfigBuilder.getInstance().setKnownHosts(opts, new 

2) or turn off the strictHostKeyChecking

        FileSystemOptions opts = new FileSystemOptions();
        FileObject fo = VFS.getManager().resolveFile("sftp://xxxx", opts);

3) Or create a class which implememnts the
com.jcraft.jsch.UserInfo interface and configure it for your connection

SftpFileSystemConfigBuilder.getInstance().setUserInfo(opts, yourUserInfo);

That way you could implement a user-dialog where you ask the user to 
trust the host.

I hope one of the ways solves your problem.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message