I am getting an exception when I try to connect to an SFTP server. I believe that it is a non-secure server, but the connection failed with FTP, as well. I confirmed with the admin that the server is, in fact, secured and should use SFTP. The code runs fine on my local machine, as a stand alone java program, but not when running on a Websphere commerce server on my local machine.
Code:
FTPSClient client = new FTPSClient();
//FTPClient client = new FTPClient();
//client.setKeyManager(km);
System.setProperty("javax.net.debug", "all");
//client.setSocketFactory(SSLSocketFactory.getDefault());
client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
client.setTrustManager(ACCEPT_ALL);
client.enterLocalPassiveMode();
client.setWantClientAuth(false);
client.setNeedClientAuth(false);
//client.setEnabledCipherSuites(null);
System.out.println("using 990'");
client.connect("obuftp.sears.com",21);
Exception (When running inside WCS env)
SystemOut O 220-| Welcome to obuftp401p FTP over SSL (FTPS) Server |
220-| We allow TLS connections on ports 21 and 990. |
220-| If you see "503 Login with USER first." use SSL. |
220
SystemOut O AUTH TLS
SystemOut O 234 Proceed with negotiation.
SystemErr R javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
SystemErr R at com.ibm.jsse2.b.c(b.java:169)
SystemErr R at com.ibm.jsse2.b.a(b.java:228)
SystemErr R at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:242)
SystemErr R at com.ibm.jsse2.SSLSocketImpl.h(SSLSocketImpl.java:437)
SystemErr R at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:142)
SystemErr R at com.ibm.jsse2.SSLSocketImpl.startHandshake(SSLSocketImpl.java:686)
SystemErr R at org.apache.commons.net.ftp.FTPSClient.sslNegotiation(FTPSClient.java:240)
SystemErr R at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:171)