我试图从ftp服务器获取文件没有运气。 commons-net 3.5版
FTPSClient ftpClient = new FTPSClient();
ftpClient.connect("xxx.com", 21);
ftpClient.enterLocalPassiveMode();
ftpClient.login("login", "password");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
FTPClientConfig conf = new FTPClientConfig();
// conf.setUnparseableEntries(true);
conf.setServerTimeZoneId("UTC");
ftpClient.configure(conf);
ftpClient.execPBSZ(0);
ftpClient.execPROT("P");
return ftpClient;
仅在取消注释conf.setUnparseableEntries(true)
后,我才能得到“东西”数组。 isFile()
方法返回false,因此我无法将File
的方法与之配合使用。它们都抛出NullPointerException。
有人建议问题出在哪里,为什么Apache无法解析文件?
添加了ftp日志:
220
AUTH TLS
234 AUTH command ok. Expecting TLS Negotiation.
USER *******
331 Password required
PASS *******
230 User logged in.
TYPE I
200 Type set to I.
PBSZ 0
200 PBSZ command successful.
PROT P
200 PROT command successful.
PASV
227 Entering Passive Mode (10,200,2,87,252,174).
LIST /INCOME
125 Data connection already open; Transfer starting.
226 Transfer complete.
QUIT
221 Goodbye.