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

查看:29
本文介绍了带有 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 是我要登录的网址,但是当将其放入主机时,为了确保安全,我所要做的就是保留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天全站免登陆