views:

26

answers:

2

All,

I have an issue with a remote ftp server that has kept me busy for three days now and I am going nuts over it. :(

A while ago, I wrote a simple ftp retriever class that uses apache commons-net 2.0. The class works fine on 5 different ftp servers, I can retrieve data as I want. Now I have come across a server that I need to connect to that just won't let me list directories or retrieve data.

This is the order of commands that are being sent and retrieved by my class:

220 (vsFTPd 2.0.1)
USER XXXXXXX
331 Please specify the password.
PASS XXXXXXX
230 Login successful
TYPE I
200 Switching to Binary mode.
PASV
227 Entering Passive Mode (XXX,XXX,XXX,XXX,XXX,XXX)
NLST
150 Here comes the directory listing.
226 Directory send OK.
SYST
215 UNIX Type: L8
PASV
227 Entering Passive Mode (XXX,XXX,XXX,XXX,XXX,XXX)
LIST
150 Here comes the directory listing.

At the last line, my code hangs indefinitely (well, I killed it after 2 hours of waiting to see how long it would block). I have tried everything, from using an active connection to setting ASCII type to using different ftp libraries - always with the same result.

Normally, I would just call the guys and tell them that their server is configured incorrectly. However, connecting via FileZilla not only works but is lightning fast and never causes any problems. Also, connecting via command line on linux works like a charm.

I am totally lost here. Does anybody have any ideas why I have this problem?

Cheers

+1  A: 

Suggestion: install Wireshark on the client machine and capture network traces under both working (filezilla) and non-working conditions to see what's different. If you're on Linux use the tcpdump command to capture the packets and then use Wireshark to examine them.

Jim Garrison
Exactly what I tried: it seems that after the `passive` command, the port switch is not performed and commons-net keeps trying to receive data through port 21. I am now working on something else, I'll dive into it next week again and waste another few days on figuring it out... :(
LeChe
+1  A: 

I cannot believe that I spent almost five days on this. After long sessions of rolling back changes, committing intermediate versions, debugging and about 15923 cups of coffee, I finally found the reason for all this mess.

It turns out that - for whatever reason - as soon as you package xpp3 drivers (as in XStream) in your ear and deploy this on JBoss 5.1, any connection via any ftp libraries will get messed up.

I have no idea if this is caused by other libraries interfering with xpp3 or if it is xpp3 itself. Frankly, I could not care less, either at the moment. All I know is that as soon as I removed that dependency from my project everything worked like a charm.

Damn you, xpp3 - I will sue you for the ten years of my life you cost me! :)

Thanks all for your help, I am going home now...

LeChe