Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用FTPS TLS连接到FTP_Java_Ftps - Fatal编程技术网

Java 使用FTPS TLS连接到FTP

Java 使用FTPS TLS连接到FTP,java,ftps,Java,Ftps,尝试使用FTP连接到FTP服务器(“TLS”,隐式)时出错 FTPSClient ftps = new FTPSClient("TLS"); ftps.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); int reply; try { ftps.connect("server"); } catch (IOException ex) {

尝试使用FTP连接到FTP服务器(“TLS”,隐式)时出错

FTPSClient ftps = new FTPSClient("TLS");
ftps.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
int reply;
    try {
        ftps.connect("server");
    } catch (IOException ex) {
        Logger.getLogger(Ftpimport.class.getName()).log(Level.SEVERE, null, ex);
    }
reply = ftps.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
    try {
        ftps.disconnect();
    } catch (IOException ex) {
        Logger.getLogger(Ftpimport.class.getName()).log(Level.SEVERE, null, ex);
    }
    throw new Exception("Exception in connecting to FTPs Server");
}
ftps.execPBSZ(0); 
ftps.execPROT("P");
ftps.login("user", "pass");
ftps.setFileType(FTP.BINARY_FILE_TYPE);
ftps.enterLocalPassiveMode();

它在“234 AUTH command ok.期待TLS协商”中出现问题。使用SSLContext和TrustManager进行了尝试,结果都是一样的。

只是为了确保。。。您是否尝试过ftps.connect()?(即:使用InetAddress)是的,他在那里输出220 Microsoft FTP服务{message}220--Auth TLS 234 Auth命令ok。期待TLS谈判(在这里被绊倒)。