commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject Re: [VFS] Sample sftp connect
Date Sun, 20 Mar 2005 16:54:08 GMT
Vogel, Timothy wrote:
>org.apache.commons.vfs.FileSystemException: Could not list the contents
>of folder sftp://user@server/somedir ".
>at
>org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractF
>ileObject.java:552)
>at com.yum.vfs.example.SftpShell.listChildren(SftpShell.java:345)
>at com.yum.vfs.example.SftpShell.ls(SftpShell.java:315)
>at com.yum.vfs.example.SftpShell.handleCommand(SftpShell.java:190)
>at com.yum.vfs.example.SftpShell.go(SftpShell.java:168)
>at com.yum.vfs.example.SftpShell.main(SftpShell.java:126)> 
>Caused by: java.util.NoSuchElementException
>at java.util.StringTokenizer.nextToken(StringTokenizer.java:259)
>at
>  
It looks like VFS has some problems in parsing your directory listing. 
Could you please try the following code and post the output (or send by 
private mail if you dont want to expose it)
Replace the YOUR_* stuff by the corresponding values.

        JSch jsch = new JSch();
        Session session = jsch.getSession("YOUR_USER",
            "YOUR_HOST",
            22);
        session.setPassword("YOUR_PASS");
        session.setUserInfo(new TrustEveryoneUserInfo());
        session.connect();
        ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
        channel.connect();
        Vector vector = channel.ls("YOUR_DIR");
        Iterator iterVector = vector.iterator();
        while (iterVector.hasNext())
        {
            System.err.println(iterVector.next());
        }

Thanks!
---
Mario


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


Mime
View raw message