Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.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(显式)服务器?_Java_Ssl_Ftps_Apache Commons Net - Fatal编程技术网

无法使用java连接到FTPS(显式)服务器?

无法使用java连接到FTPS(显式)服务器?,java,ssl,ftps,apache-commons-net,Java,Ssl,Ftps,Apache Commons Net,我使用此代码通过显式加密连接到ftps String host = "10.21.13.66"; int port = 21; String username = "user"; String password = "pass"; try { FTPSClient ftpClient = new FTPSClient("ssl",false); ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWri

我使用此代码通过显式加密连接到ftps

String host = "10.21.13.66";
int port = 21;
String username = "user";
String password = "pass";
 try {
FTPSClient ftpClient = new FTPSClient("ssl",false);
ftpClient.addProtocolCommandListener(new PrintCommandListener(new  PrintWriter(System.out)));
ftpClient.connect(host, port);
int reply = ftpClient.getReplyCode();
if (FTPReply.isPositiveCompletion(reply)) {

// Login
(ftpClient.login(username, password)) 
}
} catch (IOException ioe) {
System.out.println("FTP client received network error");
}
当我尝试连接到自己的ftps时,它返回以下错误:431没有TLS/SSL加密的安全资源,可能没有选择的SSL证书


任何帮助都将不胜感激

构建对象后,尝试使用以下代码在ftps客户端上设置身份验证:


ftpClient.setAuthValueTLS

同样的例外情况也发生在创建服务器时,我没有为它设置证书,因为我认为证书只是用于隐式连接,但我错了