You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Morus Walter <mo...@tanto-xipolis.de> on 2003/11/06 13:18:25 UTC

[VFS] sftp problems

Hi,

we're currently evaluating the VFS library basically for ftp and sftp use.
I have two problems with sftp file access:

First:
I wrote a little sample programm displaying the list of files in a
remote direcory:
class VfsTest
{
    public static void main(String argc[]) throws Exception {

	FileSystemManager fsManager = VFS.getManager();
	FileObject ftpDir = fsManager.resolveFile( "sftp://xipolis:xxx@hostname/home/xipolis/" );

	System.out.println(ftpDir.exists());

	FileObject list[] = ftpDir.findFiles(new FileDepthSelector(0,1));

	for ( int i=0; i < list.length; i++ ) {
	    System.out.println(list[i].getName().getBaseName());
	}
	System.out.println("\nDONE\n");
    }
}

While this works in principle, the programm does not terminate afterwards.
It just hangs.
I had a look at it using the debugger and I see
> threads
Group system:
  (java.lang.ref.Reference$ReferenceHandler)0x368 Reference Handler cond. waiting
  (java.lang.ref.Finalizer$FinalizerThread)0x369  Finalizer         cond. waiting
  (java.lang.Thread)0x36a                         Signal Dispatcher running
Group main:
  (java.lang.Thread)0x36c                         Thread-0          running
  (java.lang.Thread)0x36d                         DestroyJavaVM     running
> thread 0x368

but I don't know how to find out, what the finalizer and the reference handler
are waiting for.
A 'where' in the reference handler just shows
Reference Handler[1] where
  [1] java.lang.Object.wait (native method)
  [2] java.lang.Object.wait (Object.java:429)
  [3] java.lang.ref.Reference$ReferenceHandler.run (Reference.java:115)
and a 'where' in the finalizer
Finalizer[1] where
  [1] java.lang.Object.wait (native method)
  [2] java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:111)
  [3] java.lang.ref.ReferenceQueue.remove (ReferenceQueue.java:127)
  [4] java.lang.ref.Finalizer$FinalizerThread.run (Finalizer.java:159)

The situation is unchanged if I call close() for all FileObjects and
I didn't see any other methods, that might have to be called for cleaning
up.

Can anyone help me with this problem?
Am I missing something or is this a bug in the sftp handler?
Other protocols work fine.

Second:
While some connections work, I get exceptions for others.
VFS is claiming that it could not connect to the SFTP server, which is
caused by com.jcraft.jsch.JSchException: UnknownHostKey

However the host is in my .ssh/known_hosts.

As far as I've seen yet, the only difference is, that the working hosts
have an entry of type ssh-dss whereas the ones that don't work have ssh-rsa
entries.
But the http://www.jcraft.com/jsch/ says
 Host key type: ssh-dss,ssh-rsa
and a colleague reports that it's working for him even with a ssh-rsa key.

Has anyone had such a problem? Any hint what I might be doing wrong?


TIA
    Morus

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org