Background
I have been using the Authorize.net SDK in an Eclipse project of it's own. Everything was working great. I then needed to add it to my main project. I added the dependencies to the class path and the copied in the block of code that I needed. It should have worked.
Problem
Long story short, the code wouldn't work where I placed it. However, it will work when I bring it right out to the main method in the project.
In the place it won't work I stepped through the code with the debugger and found the following exception:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
thrown at:
HttpResponse httpResponse = httpClient.execute(httpPost);
Note: httpClient = DefaultHttpClient from Apache
I'm completely stumped now. Don't what is causing this error. In Eclipse both products appear to be targeting the same JRE. They also both have httpclient-4.0.1.jar. Note that The problematic project also has some other dependencies that the working project doesnt { boneCP, guava, mysql_connector_java, protobuf }
I don't think the extra jars are the cause as the problem code works at a different location in the project.
Any ideas on what is wrong are greatly appreciated, i've spent the day debugging this and don't know where to go next.
Thanks.
Well after doing some more searching I discovered the error may be related to other issues as invalid keystores, passwords etc.
I then remembered that I had set two VM arguments for when I was testing SSL for my network connectivity.
I removed the following VM arguments to fix the problem:
Note: this keystore no longer exists so that's probably why the Exception.
I've had a similar issue with this error. In my case, I was entering the incorrect password for the Keystore.
I changed the password for the Keystore to match what I was entering (I didn't want to change the password I was entering), but it still gave the same error.
Problem was that I also needed to change the Key's password within the Keystore.
When I initially created the Keystore, the Key was created with the same password as the Keystore (I accepted this default option). So I had to also change the Key's password as follows:
I had the similar issue. The problem was in the passwords: the Keystore and private key used different passwords. (KeyStore explorer was used)
After creating Keystore with the same password as private key had the issue was resolved.