Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » SSLSocket trustStore problem(Eclipse does not seem to be finding the correct keystore)
SSLSocket trustStore problem [message #647218] Wed, 05 January 2011 07:05 Go to next message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
I am developing a java application that uses SSLSockets. The application was running ok both in and outside of Eclipse before my environment got munged on my network. I restored my environment and all is well exception my application now fails in Eclipse when trying to use the SSLSocket. Outside of Eclipse it runs ok.

When I run outside of Eclipse, my command is:

java -Djavax.net.ssl.trustStore=/home/jja/keys/mykeystore -Djavax.net.ssl.trustStorePassword="blue" TestHH

In Eclipse, I have created a debuy configuration where the 'main' tab has 'TestHH' as the main class. The arguements tabs has:
-Djavax.net.ssl.trustStore=/home/jja/keys/mykeystore -Djavax.net.ssl.trustStorePassword="blue"

The SSL class has an initializer method with the following code:
try {
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("localhost", 8000);

// create input stream to listen to the client (code originally in the server code)
InputStream inputstream = sslsocket.getInputStream();
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
bufferedreader = new BufferedReader(inputstreamreader);

// create output to write to the server
OutputStream outputstream = sslsocket.getOutputStream();
OutputStreamWriter outputstreamwriter = new OutputStreamWriter(outputstream);
bufferedwriter = new BufferedWriter(outputstreamwriter);
}
catch (Exception exception) {
exception.printStackTrace();
}


In the same class, I get a stack trace on the following lines:
try {
bufferedwriter.write("open " + filename + '\n');
bufferedwriter.flush(); <---- Failing line
}


(Shortened) Stack Trace:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1639 )
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:215)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:209)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHa ndshaker.java:1033)


I would appreciate any suggestions that can help me get the application running in Eclipse again.

Jim Anderson
Re: SSLSocket trustStore problem [message #647235 is a reply to message #647218] Wed, 05 January 2011 09:14 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
The arguments should be in VM arguments.
Re: SSLSocket trustStore problem [message #647274 is a reply to message #647218] Wed, 05 January 2011 14:14 Go to previous message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member

Satyam,

Thank you! Such an easy solution. I tried so many other things, and yet that is so obvious.

Best regards,
Jim
Previous Topic:Very slow Project Explorer WorkingSet view adjustment at startup?
Next Topic:Save/restore my eclipse workspace
Goto Forum:
  


Current Time: Wed Apr 24 18:30:47 GMT 2024

Powered by FUDForum. Page generated in 0.02954 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top