commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manco <>
Subject Re: [VFS] Could not connect to SFTP server
Date Tue, 26 Apr 2005 23:12:36 GMT
Thanks for the clues, unfortunately I still cant get it to work, in fact I have taken a step
1. Is there a format for the "known_hosts" file? I tried using the format from linux/etc/hosts,
    still got the same problem.
2. I also tried suggestion #2, also no luck, same problem 
3. #3 wouldntt be the way I would be using it. I have an app that generates a bunch of files
    either another app or a thread will be running to pick up the generated files and sftp
    off to the target, no chance for user interaction.
So, I tried doing a full build of vfs using the ant build.xml file. The compile build went
all classes and a jar were/was built, including the test classes. I thouhgt maybe I could
the test and use the exact jars & versions as in the build. I attempted to run the 
"internal-tests" target but all it did was make the testreportdir and exit.  I see that there
a file, but I am not sure what I need to set to use it. 
So, I went back to my original test and now I can nolonger use FTP (not sftp),  for some reason,
which I can not figure out I am now getting:
94 [main] DEBUG org.apache.commons.vfs.impl.StandardFileSystemManager  - Skipping provider
"org.apache.commons.vfs.provider.ftp.FtpFileProvider" because required class ""
is not available.
I am using JBuilder and I have commons-net in the required libs, commons-net has a FTPFile.class,
I dont see anything called FTPFileX.

Mario Ivankovits <> wrote:
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:

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message