FTPSClient返回MalformedServerReplyException:无法解析响应代码 [英] FTPSClient returns MalformedServerReplyException: cannot parse response code

查看:165
本文介绍了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)
        }

Stacktrace

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆