带有FTP登录错误的HTTPS客户端:javax.net.ssl.SSLException:502 SSLv23/TLSv1 java [英] HTTPS Client with FTP Login Error: javax.net.ssl.SSLException: 502 SSLv23/TLSv1 java

查看:46
本文介绍了带有FTP登录错误的HTTPS客户端:javax.net.ssl.SSLException:502 SSLv23/TLSv1 java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Java来说还很陌生,所以您向我解释的越多,学到的知识就越多,我将问的问题也就越少;)我正在尝试对客户端进行编程以使其连接到ftp.availity.com,但我无法终生让客户端登录.我尝试更改端口号(443、20等),但它们都未在控制台日志中返回响应,并且仅返回超时错误.我唯一可以执行操作的端口是端口21.我知道这是FTP,并且我认为这可能是错误的来源,但是我不知道如何纠正它,因为显然更改端口#不能纠正错误.问题.任何帮助,将不胜感激!

I am pretty new to Java so the more you explain the more I learn, and less questions I will ask ;) I am trying to program a client to connect to ftp.availity.com but I cannot for the life of me get the client to login. I have tried changing the port numbers (443, 20, etc) but they all do not return a response in the console log and it only returns a timeout error. The only one I can get some action with is port 21. I know this is FTP and I think that may be where there error is coming from but I have no idea how to correct it because obviously changing the port # doesn't correct the issue. Any help would be appreciated!

这是我的代码:

import java.io.IOException;
import org.apache.commons.net.ftp.*;

public class FTPApp {
private static void showServerReply(FTPSClient ftpClient) {
    String[] replies = ftpClient.getReplyStrings();
    if (replies != null && replies.length > 0) {
        for (String aReply : replies) {
            System.out.println("SERVER: " + aReply);
        }
    }
}

public static void main(String[] args) {

    String server = "ftp.availity.com";
    int port = 21;
    String user = "user";
    String pass = "pass";
    FTPSClient ftpClient = new FTPSClient();

    try {
        ftpClient.connect( server, port);   
        showServerReply(ftpClient);
        int replyCode = ftpClient.getReplyCode();
        if (!FTPReply.isPositiveCompletion(replyCode)) {
            System.out.println("Operation failed. Server reply code: " + replyCode);
            return;
        }
        boolean success = ftpClient.login(user, pass);
        showServerReply(ftpClient);
        if (!success) {
            System.out.println("Could not login to the server");
            return;
        } else {
            System.out.println("LOGGED IN SERVER");
        }
    } catch (IOException ex) {
        System.out.println("Oops! Something wrong happened");
        ex.printStackTrace();
    }
}

}

这是错误:

Oops! Something wrong happened
javax.net.ssl.SSLException: 502 SSLv23/TLSv1
at org.apache.commons.net.ftp.FTPSClient.execAUTH(FTPSClient.java:242)
at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:225)
at org.apache.commons.net.SocketClient._connect(SocketClient.java:244)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
at FTPApp.main(FTPApp.java:23)

推荐答案

我发现了!

ftp.availity.com是我要登录的URL,但是当将其放入主机时,为了使其安全,我要做的就是保留"FTPSClient",但将主机设置为" ftps .availity.com",而不仅仅是"ftp.availity.com".

the ftp.availity.com was the url I would go to to login but when putting it in for the host, to make it secure, all I had to do was keep the "FTPSClient" but make the host "ftps.availity.com" not just "ftp.availity.com".

ftp服务器是在Axway SecureTransport或Tumbleweed下设置的,因此希望有相同问题的任何人都可以找到此线程!!!

The ftp server is setup under Axway SecureTransport or Tumbleweed so hopefully anyone with the same issue can find this thread!!!

非常感谢您对我的帮助!

Thank you all so much for helping me!

这篇关于带有FTP登录错误的HTTPS客户端:javax.net.ssl.SSLException:502 SSLv23/TLSv1 java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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