Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO

ListDirectory fails when using SOCKS5 proxy

0 votes
992 views
asked Jan 30, 2016 in Java FTP by Cartland Chiu (120 points)
I am able to successfully connect from a FTP client to an FTP server via SOCKS5 PROXY.  However when I try to do a directory listing, I encounter the error ListDirectory[] failed.  

Any help would be greatly apprecriated!  Log below.

Thanks
 
DEBUG [FTPConnectionPool] 29 Jan 2016 13:44:19.347 : Created connection #1
......................
DEBUG [AsyncResult] 29 Jan 2016 13:44:20.509 : waitTillComplete() called: com.enterprisedt.net.ftp.async.DirectoryNameListResult@33f056c4
INFO [FTPTaskProcessor] 29 Jan 2016 13:44:20.509 : Processing task 2:ListDirectory[]
DEBUG [AsyncResult] 29 Jan 2016 13:44:20.509 : Waiting until operation complete - com.enterprisedt.net.ftp.async.DirectoryNameListResult
INFO [FTPTaskProcessor] 29 Jan 2016 13:44:20.510 : Processed task 1:Connect[ftpserver.company.com:21]
DEBUG [FTPConnectionPool] 29 Jan 2016 13:44:20.510 : No free connections - create a new connection (1 conn(s) <3 max)
DEBUG [FTPTaskProcessor] 29 Jan 2016 13:44:20.510 : Creating new connection
DEBUG [FTPClient] 29 Jan 2016 13:44:20.510 : Class: com.enterprisedt.net.ftp.pro.ProFTPClient
Location: file:/C:/Users/...../jars/edtftpj-pro-4.6.1.jar
Version: 4.6.1
Build timestamp: 1-Jul-2014 16:04:29 EST
Java version: 1.8.0_66

OS name: Windows 7
OS arch: amd64
OS version: 6.1

INFO [LicensePropertiesBase] 29 Jan 2016 13:44:20.512 : Licence expiry date: 31 Dec 9999
INFO [LicensePropertiesBase] 29 Jan 2016 13:44:20.512 : Production licence
DEBUG [ProFTPClient] 29 Jan 2016 13:44:20.512 : Class: com.enterprisedt.net.ftp.pro.ProFTPClient
Location: file:/C:/Users/...../jars/edtftpj-pro-4.6.1.jar
Version: 4.6.1
Build timestamp: 1-Jul-2014 16:04:29 EST
Java version: 1.8.0_66
DEBUG [FTPConnectionPool] 29 Jan 2016 13:44:20.513 : Created connection #2
DEBUG [FTPTaskProcessor] 29 Jan 2016 13:44:20.514 : Using the current thread context
INFO [FTPTaskProcessor] 29 Jan 2016 13:44:20.514 : Freed connection for task 1
DEBUG [ProFTPClient] 29 Jan 2016 13:44:20.514 : No limit now set on transfers
INFO [FTPTaskProcessor] 29 Jan 2016 13:44:20.514 : Task 1 complete (FTPThread[FTPThread_edt_3])
DEBUG [ProFTPClient] 29 Jan 2016 13:44:20.514 : Setting integrity check to false
DEBUG [ProFTPClient] 29 Jan 2016 13:44:20.514 : Connecting to ftpserver.company.com:21
DEBUG [StreamSocketFactory] 29 Jan 2016 13:44:20.514 : Connecting to ftpserver.company.com:21 via SOCKS5 proxy
DEBUG [FTPTaskProcessor] 29 Jan 2016 13:44:20.514 : Keep alive thread: sleeping for 30000 ms
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:20.657 : 220 Service Ready.
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:20.657 : ---> USER ftpuser
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:20.692 : 331 Username ok, need password
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:20.692 : ---> PASS ********
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.304 : 230 User logged in
INFO [ConnectFTPTask] 29 Jan 2016 13:44:21.304 : Logged in
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.305 : ---> TYPE I
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.338 : 200 Type set to Image
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.338 : ---> PWD
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.372 : 257 "/" is current directory.
DEBUG [AsyncResult] 29 Jan 2016 13:44:21.372 : notifyComplete() called: com.enterprisedt.net.ftp.async.ConnectResult@5f58e58e
DEBUG [FTPTaskProcessor] 29 Jan 2016 13:44:21.372 : Reconnection succeeded
DEBUG [AsyncResult] 29 Jan 2016 13:44:21.372 : notifyComplete() called: com.enterprisedt.net.ftp.async.ConnectResult@5f58e58e
DEBUG [ConnectResult] 29 Jan 2016 13:44:21.372 : endAsync() called: com.enterprisedt.net.ftp.async.ConnectResult@5f58e58e
DEBUG [AsyncResult] 29 Jan 2016 13:44:21.372 : waitTillComplete() called: com.enterprisedt.net.ftp.async.ConnectResult@5f58e58e
DEBUG [AsyncResult] 29 Jan 2016 13:44:21.372 : waitTillComplete() exit: com.enterprisedt.net.ftp.async.ConnectResult@5f58e58e
DEBUG [FTPTaskProcessor] 29 Jan 2016 13:44:21.372 : Connection created
DEBUG [Task] 29 Jan 2016 13:44:21.372 : Remote directory unchanged [/]
DEBUG [Task] 29 Jan 2016 13:44:21.372 : Setting detect transfer mode to false
DEBUG [ProFTPControlSocket] 29 Jan 2016 13:44:21.373 : Checking if IPV6:java.net.Inet4Address (172.30.40.198)
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.373 : ---> PASV
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.405 : 227 Entering Passive Mode (54,86,251,132,212,86)
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.405 : Using proxy
INFO [FTPControlSocket] 29 Jan 2016 13:44:21.405 : Substituting server supplied IP (54.86.251.132) with remote host IP (ftpserver.company.com)
DEBUG [FTPControlSocket] 29 Jan 2016 13:44:21.406 : ---> NLST
ERROR [DirectoryNameListTask] 29 Jan 2016 13:44:42.502 : 2:ListDirectory[] failed : null
java.lang.NullPointerException
    at com.enterprisedt.net.ftp.internal.FTPPassiveDataSocket.close(FTPPassiveDataSocket.java:188)
    at com.enterprisedt.net.ftp.FTPClient.b(FTPClient.java:2686)
    at com.enterprisedt.net.ftp.FTPClient.a(FTPClient.java:3898)
    at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3912)
    at com.enterprisedt.net.ftp.async.internal.DirectoryNameListTask.run(DirectoryNameListTask.java:109)
    at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:593)

DEBUG [AsyncResult] 29 Jan 2016 13:44:42.505 : notifyComplete() called: com.enterprisedt.net.ftp.async.DirectoryNameListResult@33f056c4
DEBUG [AsyncResult] 29 Jan 2016 13:44:42.505 : waitTillComplete() exit: com.enterprisedt.net.ftp.async.DirectoryNameListResult@33f056c4
DEBUG [AsyncResult] 29 Jan 2016 13:44:42.505 : waitTillComplete() called: com.enterprisedt.net.ftp.async.DirectoryNameListResult@33f056c4
DEBUG [AsyncResult] 29 Jan 2016 13:44:42.506 : waitTillComplete() exit: com.enterprisedt.net.ftp.async.DirectoryNameListResult@33f056c4
WARN [FTPTaskProcessor] 29 Jan 2016 13:44:42.506 : Exception thrown in callback: null : null
com.enterprisedt.net.ftp.FTPException: null
    at com.enterprisedt.net.ftp.async.AsyncResult.endAsyncInternal(AsyncResult.java:315)
    at com.enterprisedt.net.ftp.async.DirectoryNameListResult.endAsync(DirectoryNameListResult.java:74)
    at com.enterprisedt.net.ftp.async.internal.DirectoryNameListTask.run(DirectoryNameListTask.java:139)
    at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:593)

INFO [FTPTaskProcessor] 29 Jan 2016 13:44:42.506 : Processed task 2:ListDirectory[]
INFO [FTPTaskProcessor] 29 Jan 2016 13:44:42.506 : Freed connection for task 2
INFO [FTPTaskProcessor] 29 Jan 2016 13:44:42.506 : Task 2 complete (FTPThread[FTPThread_edt_2])
[LOG|ERROR|29 Jan 2016 13:44:42,507|CLASS|EngineThread1| - ]
Error sending request to bloomberg: failed to get current directory contents
[END]
java.io.IOException: Directory listing failed
.....
Caused by: com.enterprisedt.net.ftp.FTPException: null
    at com.enterprisedt.net.ftp.async.AsyncResult.endAsyncInternal(AsyncResult.java:315)
    at com.enterprisedt.net.ftp.async.DirectoryNameListResult.endAsync(DirectoryNameListResult.java:74)
    at com.enterprisedt.net.ftp.SecureFileTransferClient.directoryNameList(SecureFileTransferClient.java:832)
    at com.enterprisedt.net.ftp.SecureFileTransferClient.directoryNameList(SecureFileTransferClient.java:818)

    ... 6 more

1 Answer

0 votes
answered Feb 1, 2016 by EDT Support (41,570 points)
This error was fixed in version 4.8.0.  The current version is 5.0.0.  Please update your library and try it again.
commented Feb 2, 2016 by Cartland Chiu (120 points)
Thanks for the quick response.

I tried upgrading to 5.0.0.  I now get a connection time out error.  Please note that I am logging in successfully but I cannot get a directory listing.  I am able to do the same when logging into FTP via command prompt.   Please see log below.  Thanks

DEBUG [FTPConnectionPool] 1 Feb 2016 14:01:49.839 : Created connection #4
DEBUG [FTPTaskProcessor] 1 Feb 2016 14:01:49.839 : Using the current thread context
DEBUG [ProFTPClient] 1 Feb 2016 14:01:49.839 : No limit now set on transfers
DEBUG [ProFTPClient] 1 Feb 2016 14:01:49.839 : Setting integrity check to false
DEBUG [ProFTPClient] 1 Feb 2016 14:01:49.839 : Connecting to ftpserver.com:21
DEBUG [StreamSocketFactory] 1 Feb 2016 14:01:49.839 : Connecting to ftpserver.com:21 via SOCKS5 proxy
DEBUG [StreamSocketFactory] 1 Feb 2016 14:01:49.973 : setSoTimeout(60000)
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.004 : 220 Service Ready.
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.004 : ---> USER ftpuser
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.037 : 331 Username ok, need password
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.037 : ---> PASS ********
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.923 : 230 User logged in
INFO [ConnectFTPTask] 1 Feb 2016 14:01:50.923 : Logged in
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.923 : ---> TYPE I
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.956 : 200 Type set to Image
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.956 : ---> PWD
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.988 : 257 "/" is current directory.
DEBUG [AsyncResult] 1 Feb 2016 14:01:50.988 : notifyComplete() called: com.enterprisedt.net.ftp.async.ConnectResult@46cc521c
DEBUG [FTPTaskProcessor] 1 Feb 2016 14:01:50.988 : Reconnection succeeded
DEBUG [AsyncResult] 1 Feb 2016 14:01:50.988 : notifyComplete() called: com.enterprisedt.net.ftp.async.ConnectResult@46cc521c
DEBUG [ConnectResult] 1 Feb 2016 14:01:50.988 : endAsync() called: com.enterprisedt.net.ftp.async.ConnectResult@46cc521c
DEBUG [AsyncResult] 1 Feb 2016 14:01:50.988 : waitTillComplete() called: com.enterprisedt.net.ftp.async.ConnectResult@46cc521c
DEBUG [AsyncResult] 1 Feb 2016 14:01:50.988 : waitTillComplete() exit: com.enterprisedt.net.ftp.async.ConnectResult@46cc521c
DEBUG [FTPTaskProcessor] 1 Feb 2016 14:01:50.988 : Connection created
DEBUG [Task] 1 Feb 2016 14:01:50.989 : Remote directory unchanged [/]
DEBUG [Task] 1 Feb 2016 14:01:50.989 : Setting detect transfer mode to false
DEBUG [ProFTPControlSocket] 1 Feb 2016 14:01:50.989 : Checking if IPV6:java.net.Inet4Address (172.30.40.198)
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:50.989 : ---> PASV
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:51.021 : 227 Entering Passive Mode (54,86,251,132,215,44)
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:51.021 : Using proxy
INFO [FTPControlSocket] 1 Feb 2016 14:01:51.021 : Substituting server supplied IP (54.86.251.132) with remote host IP (ftpserver.com)
DEBUG [FTPControlSocket] 1 Feb 2016 14:01:51.021 : ---> NLST
ERROR [DirectoryNameListTask] 1 Feb 2016 14:02:12.024 : 6:ListDirectory[] failed : Connection timed out: connect
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.enterprisedt.util.proxy.PlainSocket.createPlainSocket(PlainSocket.java:112)
at com.enterprisedt.net.ftp.internal.FTPPassiveDataSocket.connect(FTPPassiveDataSocket.java:112)
at com.enterprisedt.net.ftp.FTPClient.configureDataSocket(FTPClient.java:2760)
at com.enterprisedt.net.ftp.FTPClient.a(FTPClient.java:3925)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:4009)
at com.enterprisedt.net.ftp.async.internal.DirectoryNameListTask.run(DirectoryNameListTask.java:109)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:593)

DEBUG [AsyncResult] 1 Feb 2016 14:02:12.025 : notifyComplete() called: com.enterprisedt.net.ftp.async.DirectoryNameListResult@19199cd7
DEBUG [AsyncResult] 1 Feb 2016 14:02:12.025 : waitTillComplete() called: com.enterprisedt.net.ftp.async.DirectoryNameListResult@19199cd7
DEBUG [AsyncResult] 1 Feb 2016 14:02:12.025 : waitTillComplete() exit: com.enterprisedt.net.ftp.async.DirectoryNameListResult@19199cd7
[LOG|ERROR|01 Feb 2016 14:02:12,025|com.vendor.extsystem|EngineThread1| - ]
Error sending request to extsystem: failed to get current directory contents
[END]
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.enterprisedt.util.proxy.PlainSocket.createPlainSocket(PlainSocket.java:112)
at com.enterprisedt.net.ftp.internal.FTPPassiveDataSocket.connect(FTPPassiveDataSocket.java:112)
at com.enterprisedt.net.ftp.FTPClient.configureDataSocket(FTPClient.java:2760)
at com.enterprisedt.net.ftp.FTPClient.a(FTPClient.java:3925)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:4009)
at com.enterprisedt.net.ftp.async.internal.DirectoryNameListTask.run(DirectoryNameListTask.java:109)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:593)
WARN [FTPTaskProcessor] 1 Feb 2016 14:02:12.025 : Exception thrown in callback: Connection timed out: connect : Connection timed out: connect
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.enterprisedt.util.proxy.PlainSocket.createPlainSocket(PlainSocket.java:112)
at com.enterprisedt.net.ftp.internal.FTPPassiveDataSocket.connect(FTPPassiveDataSocket.java:112)
at com.enterprisedt.net.ftp.FTPClient.configureDataSocket(FTPClient.java:2760)
at com.enterprisedt.net.ftp.FTPClient.a(FTPClient.java:3925)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:4009)
at com.enterprisedt.net.ftp.async.internal.DirectoryNameListTask.run(DirectoryNameListTask.java:109)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:593)
commented Feb 2, 2016 by Admin (2,230 points)
Can you please open a ticket in our helpdesk system and attach an log file from edtFTPj/PRO and also from the command-line FTP client.  The system is secure so there's no need to mask any IP addresses or hostnames, which is important since the problem may be related to the way that they're used.  The URL is https://enterprisedt.com/help
...