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:
-Djavax.net.ssl.keyStore=mySrvKeystore -Djavax.net.ssl.keyStorePassword=123456
Note: this keystore no longer exists so that's probably why the Exception.