javasslcaliper

How to install certificate in Java1.6 so that upload from Caliper tool works


I am using Caliper to run some benchmarks and upload results to https://microbenchmarks.appspot.com/

However, the upload fails due to certificate problems with SSL (see stack trace at bottom).

How do I solve this problem?

OS: Mac OS X Mavericks 10.9 JDK: 1.6.0_27-b07-395.jdk

After trying some other SO solutions I see that in my JDK dir: /Library/Java/JavaVirtualMachines/1.6.0_27-b07-395.jdk/Contents/Home/lib/security

there is a file cacerts that is in fact a link to this file:

/System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security/cacerts

But that file doesn't exist.

I tried deleting the link and creating the store file with a fake cert as described in another response. Now it fails with:

SEVERE: Could not upload trial c8e684d4-ee41-4366-8334-ae65a9d0626f. Consider uploading it manually. com.sun.jersey.api.client.ClientHandlerException: 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


SEVERE: Could not upload trial b233811a-9ac6-4684-83f8-30e8a3d74e01. Consider uploading it manually.
com.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
    at com.sun.jersey.api.client.Client.handle(Client.java:648)
    at com.sun.jersey.api.client.WebResource.voidHandle(WebResource.java:694)
    at com.sun.jersey.api.client.WebResource.access$400(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:548)
    at com.google.caliper.runner.ResultsUploader.processTrial(ResultsUploader.java:104)
    at com.google.caliper.runner.ExperimentingCaliperRun.run(ExperimentingCaliperRun.java:231)
    at com.google.caliper.runner.CaliperMain.exitlessMain(CaliperMain.java:135)
    at com.google.caliper.runner.CaliperMain.main(CaliperMain.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
    at java.lang.Thread.run(Thread.java:680)
Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1699)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1660)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1643)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1172)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler$1$1.getOutputStream(URLConnectionClientHandler.java:225)
    at com.sun.jersey.api.client.CommittingOutputStream.commitWrite(CommittingOutputStream.java:117)
    at com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputStream.java:89)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)
    at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
    at java.io.BufferedWriter.write(BufferedWriter.java:212)
    at java.io.Writer.write(Writer.java:140)
    at com.sun.jersey.core.util.ReaderWriter.writeToAsString(ReaderWriter.java:190)
    at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:128)
    at com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:88)

Solution

  • I fixed this issue by going back and re-installing the Apple Java package from scratch.