[VFS] Connecting to a FTP server hungs up (sample included)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[VFS] Connecting to a FTP server hungs up (sample included)

J-Pro
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Connecting to a FTP server hungs up (sample included)

James Carman
It works for me.  Are you behind a firewall/proxy?

On Mon, Oct 18, 2010 at 2:21 PM, J-Pro <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Connecting to a FTP server hungs up (sample included)

J-Pro
  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<[hidden email]>  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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS][SOLVED] Connecting to a FTP server hungs up (sample included)

J-Pro
In reply to this post by James Carman
  I'm sorry, the problem is solved. It's not VFS problem, it's our
office problem.
The thing is that our IPs are not "seen from outside", but active FTP
mode needs that to be.

Sorry for disturbing you guys, the problem is solved.

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<[hidden email]>  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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS][SOLVED] Connecting to a FTP server hungs up (sample included)

James Carman
No problem!  Glad you figured it out and more glad that I didn't mess
things up with that FTPS patch! :)


On Mon, Oct 18, 2010 at 5:32 PM, J-Pro <[hidden email]> wrote:

>  I'm sorry, the problem is solved. It's not VFS problem, it's our office
> problem.
> The thing is that our IPs are not "seen from outside", but active FTP mode
> needs that to be.
>
> Sorry for disturbing you guys, the problem is solved.
>
> 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<[hidden email]>  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: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]