Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » [RESOLVED] SSL socket connection failure(When trying to open the socket, the key store is not being located?)
[RESOLVED] SSL socket connection failure [message #1235980] Sat, 25 January 2014 21:56 Go to next message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
In part of my application, I am running a client/server model, using an encrypted socket, using SSL. The application is in development, so I have a consistent need to debug using eclipse. Currently, my application is running the client/server connection ok when I run the application in batch mode. It eventually crashes because of an array overrun.

When I try to run in Eclipse, the application fails when it trys to open the socket. The lines are:

Quote:
bufferedwriter.write("open " + filename + '\n');
bufferedwriter.flush();


The actually failure is on the flush statement.

The last line in the stack trace is:

Quote:
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)


I thought about the problem and 'unable to find valid certification path to requested target' probably means that eclipse is not finding my keystore for SSL. I checked my Eclipse workspace is there is no version of the keystore in the workspace and I don't think it knows about the keystore in my CVS directory.

My question is, where will eclipse look for the keystore? Is the a menu item in the project menu where I can specify the path to my keystore in my CVS directory? Or does it need to my in the Eclipse workspace? And if so, where in the workspace should it be?

Thanks for any advice in advance! I'm still searching the Eclipse documentation, and hopefully I will find the answer soon.

BTW, I am running Juno:

Eclipse IDE for Java Developers 2.0.0.20130613-0530
Eclipse Platform 4.3.0.v20130605-2000
Java SDK 1.7 u51

on CrunchBang Linux


Jim Anderson

[Updated on: Mon, 27 January 2014 12:17] by Moderator

Report message to a moderator

Re: SSL socket connection failure [message #1236058 is a reply to message #1235980] Sun, 26 January 2014 04:10 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
On 1/25/2014 3:56 PM, Jim Anderson wrote:
>
> In part of my application, I am running a client/server model, using an
> encrypted socket, using SSL. The application is in development, so I
> have a consistent need to debug using eclipse. Currently, my application
> is running the client/server connection ok when I run the application in
> batch mode. It eventually crashes because of an array overrun.
>
> When I try to run in Eclipse, the application fails when it trys to open
> the socket. The lines are:
>
> Quote:
>> bufferedwriter.write("open " + filename + '\n');
>> bufferedwriter.flush();
>
>
> The actually failure is on the flush statement.
>
> The last line in the stack trace is:
>
> Quote:
>> 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)
>
>
> I thought about the problem and 'unable to find valid certification path
> to requested target' probably means that eclipse is not finding my
> keystore for SSL. I checked my Eclipse workspace is there is no version
> of the keystore in the workspace and I don't think it knows about the
> keystore in my CVS directory.
>
> My question is, where will eclipse look for the keystore? Is the a menu
> item in the project menu where I can specify the path to my keystore in
> my CVS directory? Or does it need to my in the Eclipse workspace? And if
> so, where in the workspace should it be?
>
> Thanks for any advice in advance! I'm still searching the Eclipse
> documentation, and hopefully I will find the answer soon.
>
> BTW, I am running Juno:
>
> Eclipse IDE for Java Developers 2.0.0.20130613-0530
> Eclipse Platform 4.3.0.v20130605-2000
> Java SDK 1.7 u51
>
> on CrunchBang Linux
>
>
> Jim Anderson
Eclipse isn't looking for the certificate. The JVM that you are
launching is looking for it. When you launch a program Eclipse creates
a new process and runs the program in its own JVM. You should
investigate how you pass certificate information to Java. You may need
to add some arguments to your launch configuration to allow Java to find
the certificate.
Re: SSL socket connection failure [message #1236081 is a reply to message #1236058] Sun, 26 January 2014 06:04 Go to previous messageGo to next message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
Thank you for your comment. I do understand that it is the java environment where the keystore is being read, and not Eclipse itself. This prompted me to look more at the command line arguments when running from a shell or running from Eclipse. In both cases, I am passing arguments "-Djavax.net.ssl.trustStore=mykeystore -Djavax.net.ssl.trustStorePassword="mypasswordhere". I thought, maybe by setting up "-Djavax.net.ssl.trustStore=/home/jim/adir/bdir/mykeystore" so that the JVM running with Eclipse knows the full path to my keystore, my problem will be solved. Not so.

I found this article http://code.naishe.in/2011/07/looks-like-article-no-more-unable-to.html in a google search. It suggests that the JSSE when running in Eclipse will not accept a test key generated by keytool, which is exactly what I am doing. It goes on to explain how to generate an acceptable key. It is too late to try this now, but I will try tomorrow or Monday. I'm pretty sure this will solve my problem. If I am correct and it works, the sited article will be helpful to anyone trying to use SSL in the Eclipse environment. I will get back on this.
Re: SSL socket connection failure [message #1236083 is a reply to message #1236058] Sun, 26 January 2014 06:09 Go to previous messageGo to next message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
No Message Body

[Updated on: Sun, 26 January 2014 18:12] by Moderator

Report message to a moderator

[RESOLVED] Re: SSL socket connection failure [message #1236521 is a reply to message #1236083] Mon, 27 January 2014 12:14 Go to previous message
Jim Anderson is currently offline Jim AndersonFriend
Messages: 109
Registered: October 2014
Senior Member
The web page mention in my previous post was very helpful and correctly identified my problem. It took a bit of time to work through the solution because I made some errors and misinterpretations along the way, but it did work out. I have documented my steps below in case someone else has the same problem that I had.



Quote:
1) See write up at:
http://code.naishe.in/2011/07/looks-like-article-no-more-unable-to.html
2) Down load InstallCert.java from:
http://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java

3) change the package statement in InstallCert.java for you own needs. I changed it to
package bfs.installCert;

4) compile InstallCert.java

5) run InstallCert:
java bfs.installCert.InstallCert furillo:800

6) verify that you JAVA_HOME environment variable is set properly. I set it to:
setenv JAVA_HOME /usr/share/java/jdk1.7.0_51

7) copy jssecacerts to $JAVA_HOME/jre/lib/security. My $JAVA_HOME is root protected
so I needed root privleges to do this.

cp jssecacerts $JAVA_HOME/jre/lib/security/

8 ) rerun InstallCert:
java bfs.installCert.InstallCert furillo:800

In my case, this failed.
I spend about 30 minutes trying to get this to work, but no luck.
I figured that I may as well try to run Eclipse.

9) run Eclipse.
With jssecaserts installed on $JAVA_HOME/jre/lib/security, Eclipse ran as it should.


I am curious why step 8 failed, but Eclipse is working, so I am moving on to working on
my application again.

[Updated on: Mon, 27 January 2014 12:15] by Moderator

Report message to a moderator

Previous Topic:Use org.eclipse.jdt.ui classes without X-Server
Next Topic:Kepler Text Editor Defect: Vertical Scrollbar Pops out, covering last character
Goto Forum:
  


Current Time: Fri Apr 26 06:52:59 GMT 2024

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

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

Back to the top