Weefribbort
New Member
Just confirmed that the FTPS server is indeed working using Filezilla. Quite puzzled with this exception. Code\[code\]FTPSClient client = null; try { client = new FTPSClient(protocol, isImpicit); } catch (NoSuchAlgorithmException e1) { // TODO Auto-generated catch block Logger.debug(e1); e1.printStackTrace(); } client.setDataTimeout(timeoutInMillis); //client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); System.out.println("################ Connecting to Server ################################"); try { int reply; System.out.println("################ Connect Call ################################"); client.connect(ftpServer, ftpPort); client.login(username, password); System.out.println("################ Login Success ################################"); //client.setFileType(FTP.BINARY_FILE_TYPE); client.setFileType(FTP.NON_PRINT_TEXT_FORMAT); client.execPBSZ(0); // Set protection buffer size client.execPROT("P"); // Set data channel protection to private client.enterLocalPassiveMode(); System.out.println("Connected to " + server + "."); reply = client.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { client.disconnect(); System.err.println("FTP server refused connection."); System.exit(1); } client.listFiles(); //boolean retrieved = client.retrieveFile(remoteFile, new FileOutputStream(localFile)); } catch (Exception e) { if (client.isConnected()) { try { client.disconnect(); } catch (IOException ex) { ex.printStackTrace(); } } System.err.println("Could not connect to server."); e.printStackTrace(); return client; } finally { //client.disconnect(); try { client.logout(); } catch (IOException e) { // TODO Auto-generated catch block Logger.debug(e); e.printStackTrace(); } System.out.println("# client disconnected"); } return client;\[/code\]Stacktrace\[code\]################ Connecting to Server ################################################ Connect Call ################################Could not connect to server.javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:523) at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149) at org.apache.commons.net.ftp.FTPSClient.sslNegotiation(FTPSClient.java:240) at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:166) at org.apache.commons.net.SocketClient.connect(SocketClient.java:178) at myFtpService.getFtpConnection(myFtpService.java:61)\[/code\]