- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 FTPS 将给定目录下的所有子目录和文件从 FTP 服务器复制到本地计算机。我编写的程序在轰炸之前获取了一些子目录和文件。每次程序轰炸并不总是在同一个地方。我收到的代码和错误如下。关于如何让它发挥作用有什么想法吗?
import org.apache.commons.net.PrintCommandListener;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPConnectionClosedException;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.net.ftp.FTPSClient;
public class SaigFileBuilder {
private String server = "host";
private String username = "user";
private String password = "pass";
private String remoteParentDir = "/prd/fa/out/FA003100/SAIG/";
private String filesep = System.getProperty("file.separator");
private String local = "c:" + filesep + "temp" + filesep + "saig_files";
private List<String> fileList = null;
private boolean error = false;
private String protocol = "TLS"; // SSL/TLS
private FTPSClient ftps = null;
public static void main(String[] args) {
SaigFileBuilder fb = new SaigFileBuilder();
try {
fb.getClientConnection();
fb.getFiles(false);
fb.logout();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
System.exit(fb.error ? 1 : 0);
}
private void getClientConnection() throws NoSuchAlgorithmException {
this.ftps = new FTPSClient(this.protocol);
this.ftps.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
this.ftps = getConnection(server);
this.ftps = getLogin(username, password);
}
private FTPSClient getConnection(String server) {
try
{
int reply;
// Connect to the FTP server...
this.ftps.connect(server);
System.out.println("Connected to " + server + ".");
// Get connect reply code...
reply = this.ftps.getReplyCode();
System.out.println("String reply: " + this.ftps.getReplyString());
// Verify successful connection reply code was returned...
if (!FTPReply.isPositiveCompletion(reply))
{
error = true;
System.err.println("FTP server refused connection.");
return null;
}
// FileZilla client issues following, so I will too..
this.ftps.sendCommand("OPTS UTF8 ON");
this.ftps.execPBSZ(0);
this.ftps.execPROT("P");
this.ftps.enterLocalPassiveMode();
}
catch (IOException e)
{
System.err.println("Could not connect to server.");
e.printStackTrace();
}
return this.ftps;
}
private FTPSClient getLogin(String username, String password) {
try
{
this.ftps.setBufferSize(1000);
if (!this.ftps.login(username, password))
{
System.out.println("Login failed");
this.ftps.logout();
return null;
}
System.out.println("Remote system is " + this.ftps.getSystemType());
}
catch (FTPConnectionClosedException e)
{
error = true;
System.err.println("Server closed connection.");
e.printStackTrace();
}
catch (IOException e)
{
error = true;
e.printStackTrace();
}
return this.ftps;
}
private void getFiles(boolean binaryTransfer) {
try
{
if (binaryTransfer) {
this.ftps.setFileType(FTP.BINARY_FILE_TYPE);
}
OutputStream output = null;
this.ftps.changeWorkingDirectory(this.remoteParentDir);
System.out.println("pwd: " + this.ftps.printWorkingDirectory());
this.fileList = new ArrayList<String>();
scanDirTree(this.remoteParentDir);
System.out.println("Finished scanning...");
for (String file : this.fileList) {
System.out.println(file);
}
String dirHold = " ";
String winDir = " ";
String winFile = " ";
for (String ftpFilePath : this.fileList) {
// Going to copy the remote dirs and files to local, so change the paths to
// use local Windows file separator instead of remote Unix...
winDir = ftpFilePath.substring(0, ftpFilePath.lastIndexOf("/") + 1).replace("/", filesep);
winFile = ftpFilePath.substring(ftpFilePath.lastIndexOf("/") + 1, ftpFilePath.length());
System.out.println("winDir.: " + winDir);
System.out.println("winFile: " + winFile);
// If new dir found in list, then create it locally...
if (dirHold.equals(winDir) == false) {
System.out.println("mkdir: " + local + winDir);
new File(local + winDir).mkdirs();
dirHold = winDir;
}
// And write the file locally...
System.out.println("Attempting to write: " + this.local + winDir + winFile);
output = new FileOutputStream(local + winDir + winFile);
this.ftps.retrieveFile(ftpFilePath, output);
output.close();
output = null;
}
}
catch (FTPConnectionClosedException e)
{
error = true;
System.err.println("Server closed connection.");
e.printStackTrace();
}
catch (IOException e)
{
error = true;
e.printStackTrace();
}
}
private void scanDirTree(String directory) throws IOException {
// Create and return a list of all dirs and files on remote
// server below the parent dir that was passed to this method...
FTPFile[] files = this.ftps.listFiles(directory);
if (files.length == 0) {
System.out.println("no files in " + directory);
}
for (FTPFile file : files) {
String name = file.getName();
if (!".".equals(name) && !"..".equals(name)) {
if (file.isDirectory()) {
// Recursive call, go deeper...
scanDirTree(directory + name + "/");
} else {
fileList.add(directory + file.getName());
System.out.println("Added: " + directory + file.getName());
}
}
}
}
private void logout() {
if (this.ftps.isConnected()) {
try {
System.out.println("Logging out...");
this.ftps.logout();
System.out.println("Disconnecting...");
this.ftps.disconnect();
}
catch (IOException e) {
error = true;
}
}
}
}
这是错误:
220 (vsFTPd 2.0.5)
AUTH TLS
234 Proceed with negotiation.
Connected to xxx.xxx.xxx
String reply: 234 Proceed with negotiation.
OPTS UTF8 ON
200 Always in UTF8 mode.
PBSZ 0
200 PBSZ set to 0.
PROT P
200 PROT now Private.
USER xxx
331 Please specify the password.
PASS xxxx
230 Login successful.
SYST
215 UNIX Type: L8
Remote system is UNIX Type: L8
CWD /prd/fa/out/FA003100/SAIG/
250 Directory successfully changed.
PWD
257 "/prd/fa/out/FA003100/SAIG"
pwd: /prd/fa/out/FA003100/SAIG
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,29)
LIST /prd/fa/out/FA003100/SAIG/
150 Here comes the directory listing.
226 Directory send OK.
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,46)
LIST /prd/fa/out/FA003100/SAIG/2012/
150 Here comes the directory listing.
226 Directory send OK.
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,150)
LIST /prd/fa/out/FA003100/SAIG/2012/DirectLoan/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-G.xml
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GCHG.xml
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GDISB.xml
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-U.xml
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UCHG.xml
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UDISB.xml
Added: /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,196,232)
LIST /prd/fa/out/FA003100/SAIG/2012/Isir/
150 Here comes the directory listing.
226 Directory send OK.
no files in /prd/fa/out/FA003100/SAIG/2012/Isir/
PASV
227 Entering Passive Mode (xx,xx,xxx,x,196,254)
LIST /prd/fa/out/FA003100/SAIG/2012/Pell/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN.xml
Added: /prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN_DISB.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,5)
LIST /prd/fa/out/FA003100/SAIG/2012/Teach/
150 Here comes the directory listing.
226 Directory send OK.
no files in /prd/fa/out/FA003100/SAIG/2012/Teach/
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,66)
LIST /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.01
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.02
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.03
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.04
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.05
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.06
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.07
Added: /prd/fa/out/FA003100/SAIG/2012/TrnsMonitorTRNINFIN.01
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,3)
LIST /prd/fa/out/FA003100/SAIG/2013/
150 Here comes the directory listing.
226 Directory send OK.
PASV
227 Entering Passive Mode (xx,xx,xxx,x,196,230)
LIST /prd/fa/out/FA003100/SAIG/2013/CommRec/
150 Here comes the directory listing.
226 Directory send OK.
no files in /prd/fa/out/FA003100/SAIG/2013/CommRec/
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,135)
LIST /prd/fa/out/FA003100/SAIG/2013/DLReconciliation/
150 Here comes the directory listing.
226 Directory send OK.
no files in /prd/fa/out/FA003100/SAIG/2013/DLReconciliation/
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,124)
LIST /prd/fa/out/FA003100/SAIG/2013/DirectLoan/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-G.xml
Added: /prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-GCHG.xml
Added: /prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-GDISB.xml
Added: /prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-U.xml
Added: /prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-UCHG.xml
Added: /prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-UDISB.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,121)
LIST /prd/fa/out/FA003100/SAIG/2013/Isir/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.001
Added: /prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.002
Added: /prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.003
Added: /prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.004
Added: /prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.005
Added: /prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.006
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,147)
LIST /prd/fa/out/FA003100/SAIG/2013/Pell/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2013/Pell/CRPG13IN.xml
Added: /prd/fa/out/FA003100/SAIG/2013/Pell/CRPG13IN_DISB.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,63)
LIST /prd/fa/out/FA003100/SAIG/2013/SysGen/
150 Here comes the directory listing.
226 Directory send OK.
no files in /prd/fa/out/FA003100/SAIG/2013/SysGen/
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,118)
LIST /prd/fa/out/FA003100/SAIG/2013/TrnsMonitor/
150 Here comes the directory listing.
226 Directory send OK.
Added: /prd/fa/out/FA003100/SAIG/2013/TrnsMonitor/TRNINFIN.01
Finished scanning...
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-G.xml
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GCHG.xml
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GDISB.xml
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-U.xml
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UCHG.xml
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UDISB.xml
/prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN.xml
/prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN.xml
/prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN_DISB.xml
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.01
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.02
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.03
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.04
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.05
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.06
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.07
/prd/fa/out/FA003100/SAIG/2012/TrnsMonitorTRNINFIN.01
/prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-G.xml
/prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-GCHG.xml
/prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-GDISB.xml
/prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-U.xml
/prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-UCHG.xml
/prd/fa/out/FA003100/SAIG/2013/DirectLoan/CRDL13IN-UDISB.xml
/prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.001
/prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.002
/prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.003
/prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.004
/prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.005
/prd/fa/out/FA003100/SAIG/2013/Isir/CORR13IN.006
/prd/fa/out/FA003100/SAIG/2013/Pell/CRPG13IN.xml
/prd/fa/out/FA003100/SAIG/2013/Pell/CRPG13IN_DISB.xml
/prd/fa/out/FA003100/SAIG/2013/TrnsMonitor/TRNINFIN.01
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN-G.xml
mkdir: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN-G.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,16)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-G.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-G.xml (4561 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN-GCHG.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN-GCHG.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,136)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GCHG.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GCHG.xml (9074 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN-GDISB.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN-GDISB.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,196,239)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GDISB.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GDISB.xml (2047 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN-U.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN-U.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,137)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-U.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-U.xml (3367 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN-UCHG.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN-UCHG.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,196,243)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UCHG.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UCHG.xml (7503 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN-UDISB.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN-UDISB.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,87)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UDISB.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UDISB.xml (2995 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\DirectLoan\
winFile: CRDL12IN.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\DirectLoan\CRDL12IN.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,196,251)
RETR /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN.xml (145846 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\Pell\
winFile: CRPG12IN.xml
mkdir: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\Pell\
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\Pell\CRPG12IN.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,123)
RETR /prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN.xml (2057 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\Pell\
winFile: CRPG12IN_DISB.xml
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\Pell\CRPG12IN_DISB.xml
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,21)
RETR /prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN_DISB.xml
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/Pell/CRPG12IN_DISB.xml (9709 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.01
mkdir: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.01
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,119)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.01
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.01 (453 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.02
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.02
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,101)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.02
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.02 (604 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.03
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.03
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,109)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.03
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.03 (453 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.04
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.04
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,18)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.04
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.04 (453 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.05
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.05
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,84)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.05
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.05 (604 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.06
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.06
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,70)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.06
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.06 (453 bytes).
226 File send OK.
winDir.: \prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\
winFile: TRNINFIN.07
Attempting to write: c:\temp\saig_files\prd\fa\out\FA003100\SAIG\2012\TrnsMonitor\TRNINFIN.07
PASV
227 Entering Passive Mode (xx,xx,xxx,x,197,119)
RETR /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.07
150 Opening BINARY mode data connection for /prd/fa/out/FA003100/SAIG/2012/TrnsMonitor/TRNINFIN.07 (3624 bytes).
org.apache.commons.net.io.CopyStreamException: IOException caught while copying.
at org.apache.commons.net.io.Util.copyStream(Util.java:135)
at org.apache.commons.net.ftp.FTPClient._retrieveFile(FTPClient.java:1695)
at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1669)
at edu.ohio.saig.SaigFileBuilder.getFiles(SaigFileBuilder.java:196)
at edu.ohio.saig.SaigFileBuilder.main(SaigFileBuilder.java:63)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at java.io.PushbackInputStream.read(Unknown Source)
Logging out...
at org.apache.commons.net.io.FromNetASCIIInputStream.read(FromNetASCIIInputStream.java:161)
at org.apache.commons.net.io.FromNetASCIIInputStream.read(FromNetASCIIInputStream.java:139)
at org.apache.commons.net.io.Util.copyStream(Util.java:101)
... 4 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
... 15 more
QUIT
注意我可以使用 FileZilla 手动将父目录复制到本地计算机,所有子目录和文件都会自动复制。以下是 FileZilla session 的日志:
Status: Resolving address of xxx.xxx.xxx
Status: Connecting to xx.xx.xxx.x:21...
Status: Connection established, waiting for welcome message...
Response: 220 (vsFTPd 2.0.5)
Command: AUTH TLS
Response: 234 Proceed with negotiation.
Status: Initializing TLS...
Status: Verifying certificate...
Command: USER xxxxx
Status: TLS/SSL connection established.
Response: 331 Please specify the password.
Command: PASS ************
Response: 230 Login successful.
Command: OPTS UTF8 ON
Response: 200 Always in UTF8 mode.
Command: PBSZ 0
Response: 200 PBSZ set to 0.
Command: PROT P
Response: 200 PROT now Private.
Status: Connected
Status: Sending keep-alive command
Command: TYPE A
Response: 200 Switching to ASCII mode.
Status: Sending keep-alive command
Command: PWD
Response: 257 "/prd/fa/out/FA003100/SAIG/2013/TrnsMonitor"
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/TrnsMonitorTRNINFIN.01
Command: CWD /prd/fa/out/FA003100/SAIG/2012
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN.xml
Command: CWD /prd/fa/out/FA003100/SAIG/2012/DirectLoan
Response: 250 Directory successfully changed.
Command: PASV
Response: 250 Directory successfully changed.
Command: PASV
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,141)
Command: RETR TrnsMonitorTRNINFIN.01
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,118)
Command: RETR CRDL12IN.xml
Response: 150 Opening BINARY mode data connection for TrnsMonitorTRNINFIN.01 (3775 bytes).
Response: 150 Opening BINARY mode data connection for CRDL12IN.xml (145846 bytes).
Response: 226 File send OK.
Status: File transfer successful, transferred 3,775 bytes in 1 second
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UDISB.xml
Command: CWD /prd/fa/out/FA003100/SAIG/2012/DirectLoan
Response: 250 Directory successfully changed.
Command: TYPE A
Response: 200 Switching to ASCII mode.
Command: PASV
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,53)
Command: RETR CRDL12IN-UDISB.xml
Response: 150 Opening BINARY mode data connection for CRDL12IN-UDISB.xml (2995 bytes).
Response: 226 File send OK.
Status: File transfer successful, transferred 145,846 bytes in 1 second
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-UCHG.xml
Command: PASV
Response: 226 File send OK.
Status: File transfer successful, transferred 2,995 bytes in 1 second
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-U.xml
Command: PASV
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,123)
Command: RETR CRDL12IN-UCHG.xml
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,51)
Command: RETR CRDL12IN-U.xml
Response: 150 Opening BINARY mode data connection for CRDL12IN-UCHG.xml (7503 bytes).
Response: 150 Opening BINARY mode data connection for CRDL12IN-U.xml (3367 bytes).
Response: 226 File send OK.
Status: File transfer successful, transferred 3,367 bytes in 1 second
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GDISB.xml
Command: PASV
Response: 226 File send OK.
Status: File transfer successful, transferred 7,503 bytes in 1 second
Status: Starting download of /prd/fa/out/FA003100/SAIG/2012/DirectLoan/CRDL12IN-GCHG.xml
Command: PASV
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,25)
Command: RETR CRDL12IN-GDISB.xml
Response: 227 Entering Passive Mode (xx,xx,xxx,x,197,28)
Command: RETR CRDL12IN-GCHG.xml
Response: 150 Opening BINARY mode data connection for CRDL12IN-GDISB.xml (2047 bytes).
Response: 150 Opening BINARY mode data connection for CRDL12IN-GCHG.xml (9074 bytes).
Response: 226 File send OK.
.
.
.
Status: Disconnected from server
最佳答案
好的,我已经找到了错误的原因,但不确定如何解决它。多次调用retrieveFile()方法时会导致该错误。在我看来,该方法向 FTP 服务器发出 PASV 命令。服务器使用随机端口号进行响应,以便客户端检索文件。但是,服务器有时会重用端口,当发生这种情况时,发送 RETR 命令时会引发异常。
我不确定是否需要断开连接并重新连接/登录才能继续。我在异常处理中设置了一个小测试来重新连接,但该测试抛出错误 javax.net.ssl.SSLException: 无法识别的 SSL 消息,纯文本连接。
我会继续努力,但欢迎任何评论/帮助。
关于java - 使用 FTPS 递归复制子目录失败(可能是握手问题?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11731178/
我在使用以下代码时遇到问题: function http_file_exists($url){ $f=fopen($url,"r"); if($f){ fclose($f); retu
我已经通过 Git 部署到 Azure 几个月了,没有出现重大问题,但现在我似乎遇到了一个无法克服的错误。 我创建了一个新的 Azure 网站,为正在开发的项目创建单独的预览链接。我在新站点上设置了
我已经通过flutter创建了一个App并完成了它,我想在flutter文档中阅读时进行部署。 我收到此错误: FAILURE: Build failed with an exception. * W
我在Windows 10中使用一些简单的Powershell代码遇到了这个奇怪的问题,我认为这可能是我做错了,但我不是Powershell的天才。 我有这个: $ix = [System.Net.Dn
我正在尝试使用 RapidJSON 解析从服务器接收到的数据。以下是收到的确切字符串: [ { "Node": "9478149a08f9", "Address": "172.17
我尝试为 ios 编译 OpenCV。我总是收到这些错误。我用不同版本的opencv试了一下,结果都是一样的。 我运行这个:python 平台/ios/build_framework.py ios_o
我在一台机器上做基本的发布/订阅,我的客户端是 StackExchange-Redis 的 C# 客户端,我在同一台机器上运行基于 Windows 的 Redis 服务器(服务器版本 2.8.4) 当
我有这段代码,但无法执行,请帮我解决这个问题 连接 connect_error) { die ("connection failed: " . $terhubung->connect_erro
我在 tomcat 上运行并由 maven 编译的 Web 应用程序给出了以下警告和错误。我可以在本地存储库中看到所有 JAR,但有人可以帮忙吗。 WARNING: Failed to scan JA
我正在 Windows 8 上使用 Android Studio 开发一个 android 应用程序,我正在使用一些 native 代码。突然间我无法编译我的 C 文件。当我运行 ndk-build
下面的代码对类和结构的成员进行序列化和反序列化。序列化工作正常,但我在尝试使用 oarch >> BOOST_SERIALIZATION_NVP(outObj); 反序列化时遇到了以下错误; 代码中是
如果我运行此命令“rspec ./spec/requests/api/v1/password_reset_request_spec.rb”,此文件中的所有测试都会通过。 但是,当我运行“rspec”时
我在尝试执行测试以使用 Protractor 上传文件时出错,我的代码是这个 it('it should be possible to upload a file', function() {
System.loadLibrary("nativefaceswap"); 当我运行我的应用程序时,我在 Android Studio 中发现了此类错误。在logcat中显示: java.lang.U
我希望有人能帮助我!使用任何方法或命令行的任何 SSL/HTTPS 调用均无效。 我在 Windows 10 中使用 Ubuntu Server 18.04 作为子系统。我的问题是昨天才开始出现的,因
通过删除这两个值将日期字段从 null=True 和 Blank=True 更改为 required 时,使用 db.alter 命令时遇到问题。 当以下行被注释掉时,迁移运行不会出现问题。
我第一次使用 Heroku 尝试创建应用程序(使用 SendGrid 的 Inbound Parse Webhook"和 Twilio SMS 通过电子邮件发送和接收 SMS 消息)。通过 Virtu
我正在将我的 swift 项目更新到 Xcode 7 上的 Swift 2.0。xcode 在构建项目时报告了以下错误: 命令/Applications/Xcode.app/Contents/Deve
在我的代码中,SSL 库函数 SSL_library_init() 没有按预期返回 1。我如何才能看到它返回了什么错误? 我在 SSL_library_init() 之后调用了 SSL_load_er
我正在尝试运行在以下链接中找到的答案: Asynchronously Load the Contents of a Div 但是当我这样做时,我会遇到我不太理解的错误。 我的代码: $(documen
我是一名优秀的程序员,十分优秀!