这真的很奇怪,为什么西宏会返回我的日食位置,以及我的SFTP密码作为FileSystemException的一部分。
我已经检查了远程主机确实是一个SFTP服务器,并且客户机正在使用SFTP进行连接。
齐宏API 这里
Stacktrace
Reading file from C:\srcFolde\FileToBeUploaded.zip
com.zehon.exception.FileTransferException:
org.apache.commons.vfs.FileSystemException:
Unknown message with code:
"C:<location of eclipse>/<sftp password>?" does not exist
at int result = sftp.sendFile(filePath, ftpDestFolder);码
SFTPClient sftp = new SFTPClient(ftpServer, 22, ftpUserName, ftpPassword, true);
FileInputStream fis = null;
try {
fis = new FileInputStream(fileName);
String filePath=fileName.substring(0, fileName.length()-4) + ".zip";
String ftpDestFolder="\\sftpDestFolder";
int result = sftp.sendFile(filePath, ftpDestFolder);
Logger.debug("sftp result = " + result);
} catch (FileTransferException e) {
e.printStackTrace();
return false;
} finally {
try {
if (fis != null) {
fis.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}发布于 2013-03-28 14:24:20
您使用了错误的构造函数。从Javadocs
http://www.zehon.com/javadocs/com/zehon/sftp/SFTPClient.html
您已经通过了ftpPassword,它在那里期待privateKeyPath。
https://stackoverflow.com/questions/15684173
复制相似问题