commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J-Pro <jpro....@gmail.com>
Subject [VFS] Connecting to a FTP server hungs up (sample included)
Date Mon, 18 Oct 2010 18:21:59 GMT
  Good afternoon.

Please help me solve my problem.
I'm trying to download a file "CBCP.TXT" from 
"ftp://ftp.microsoft.com:21/MISC", but VFS hangs up after this log:

    10-18 20:22:42.787 EEST [main] INFO 
org.apache.commons.vfs.impl.DefaultFileReplicator  - Using
    "C:\Temp\vfs_cache" as temporary files store.
    10-18 20:22:42.857 EEST [main] DEBUG
    org.apache.commons.vfs.impl.StandardFileSystemManager  - Skipping
    provider "org.apache.commons.vfs.provider.http.HttpFileProvider"
    because required class "org.apache.commons.httpclient.HttpClient" is
    not available.
    10-18 20:22:42.858 EEST [main] DEBUG
    org.apache.commons.vfs.impl.StandardFileSystemManager  - Skipping
    provider "org.apache.commons.vfs.provider.https.HttpsFileProvider"
    because required class "org.apache.commons.httpclient.HttpClient" is
    not available.
    10-18 20:22:44.403 EEST [main] DEBUG
    org.apache.commons.vfs.cache.SoftRefFilesCache  - putFile:
    ftp://ftp.microsoft.com/MISC
    10-18 20:22:44.404 EEST [main] DEBUG
    org.apache.commons.vfs.cache.SoftRefFilesCache  - putFile:
    ftp://ftp.microsoft.com/

I'm using this code inside my main method(for sure surrounded by 
try/catch block):

    String fileName = "CBCP.TXT";
    FileSystemManager fsManager;
    fsManager = VFS.getManager();
    UserAuthenticator auth = new StaticUserAuthenticator(null,
    "anonymous", "");
    FileSystemOptions srcOpts = new FileSystemOptions();
    String sourceDirAsString = "ftp://ftp.microsoft.com:21/MISC";
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(srcOpts,
    auth);
    FileObject sourceDir = fsManager.resolveFile(sourceDirAsString,
    srcOpts); // HERE IS A HANG UP
    FileObject neededFile = sourceDir.resolveFile(fileName);

In the marked the line where hang up happens, i.e. application freezes 
and waits.
I've run it in debug mode and made a screenshot of suspended main stack: 
http://img690.imageshack.us/img690/1412/mainm.png

I've successfully opened this FTP using both firefox and internet 
explorer. Why I can't open it using VFS?

Thanks in advance!


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


Mime
View raw message