FTPSClient 返回 MalformedServerReplyException:无法解析响应代码 [英] FTPSClient returns MalformedServerReplyException: cannot parse response code
本文介绍了FTPSClient 返回 MalformedServerReplyException:无法解析响应代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设置了 SFTP 连接.我使用了 WinCSP 和 Filezilla,测试服务器运行没有问题.java代码来自apache commons-net 2.0
,它给了我意外的错误
I have an SFTP connection set up. I used WinCSP and Filezilla and the test server is working no problem. The java code is from the apache commons-net 2.0
and it gives me the unexpected error
代码
private String ftpServer="XXX.xx.x.XX";
private int ftpPort=99;
private String ftpUserName="myUserName";
private String ftpPassword="myPassword";
FTPSClient ftp = null;
try{
ftp = new FTPSClient();
ftp.connect(hostname, port)
} catch (Exception e){
Logger.debug(e)
}
堆栈跟踪
Server reply:SSH-2.0-WeOnlyDo-wodFTPD 2.3.6.165
org.apache.commons.net.MalformedServerReplyException: Could not parse response code.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:315)
at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:364)
at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:540)
at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:167)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:178)
at myHomeFtpService.getFtpConnection(HomeFtpService.java:40)
推荐答案
由于您使用 FTP 客户端连接到 SSH 服务器.FTPS 和 SFTP 是两种不同的协议.
Since you are connecting to an SSH server using FTP client. FTPS and SFTP are two different protocols.
WinSCP 和 Filezilla 运行良好,因为它们支持 SFTP.
Both WinSCP and Filezilla works fine because they supports SFTP.
这篇关于FTPSClient 返回 MalformedServerReplyException:无法解析响应代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文