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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…