commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J-Pro <jpro....@gmail.com>
Subject Re: [VFS] Connecting to a FTP server hungs up (sample included)
Date Mon, 18 Oct 2010 19:11:24 GMT
  Strange... Thanks for testing, Steven and James.
No, I'm not behind a firewall. If not to take in consideration Windows 7 
embedded firewall, but I doubt that it doesn't allow FTP active data 
connection.

I've tried to connect to my home FTP server and checked logs. It says 
that last client command was "LIST" and after 20 seconds server replied: 
"425 Cannot open data connection". After few such tries server closed 
the connection. Yes, it seems like something is blocking active FTP 
connection, but I've checked Windows 7 firewall logs, there are no 
blocked packages on ports 21 or 20.

Also one interesting thing... When I set passive 
mode(FtpFileSystemConfigBuilder.getInstance().setPassiveMode(srcOpts, 
true)), it successfully works...

I can't even imagine what's the reason... By the way... I've said that 
browsers CAN open this address. Do they automatically use passive mode 
if active fails?

Thanks.


On 18.10.2010 22:02, James Carman wrote:
> It works for me.  Are you behind a firewall/proxy?
>
> On Mon, Oct 18, 2010 at 2:21 PM, J-Pro<jpro.swt@gmail.com>  wrote:
>>   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
>>
>>

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


Mime
View raw message