Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do I get javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated only in production?
    primarykey
    data
    text
    <p>I have a grails 1.3.7 application that makes an https api call to a third party using the apache HttpClient. The third party URL I'm hitting has a valid certificate. I create and execute my request like so:</p> <pre><code>HttpClient client = new DefaultHttpClient() List&lt;BasicNameValuePair&gt; queryParams = new ArrayList&lt;BasicNameValuePair&gt;() queryParams.add(new BasicNameValuePair("a_parameter", "a_parameter_value")) URI uri = URIUtils.createURI("https", "third.party.address", 443, "/some/url/for/us", URLEncodedUtils.format(queryParams, "UTF-8"), null) HttpGet httpGet = new HttpGet(uri) try { log.debug "Sending request to ${uri}" return client.execute(httpGet) } catch(HttpException e) { log.error "HttpException during location lookup request: ${e}" return } catch(IOException e) { log.error "IOException during location lookup request: ${e}" return } </code></pre> <p>This works fine when I'm running my project in dev mode. I'm also able to directly call the same URL from curl and my browser with no errors. However, once my project is built into a war file and put on a tomcat instance that has a certificate/keystore defined so that clients can connect to US using https, my requests start failing with the following IOException:</p> <pre><code>javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated </code></pre> <p>I'm trying to figure out the point of failure here. </p> <p><strong>Why is making an https request from curl or my dev mode different than making an https request from an https configured tomcat instance?</strong></p> <p>The tomcat instance is not publicly accessible, but there are no certificate issues when I connect to it from my browser (chrome says the cert is fine, as does a verbose curl request).</p> <p>I'm not an https/ssl expert by any stretch, so I'm looking for help explaining what is wrong, why it's wrong, and how I can fix it. I can provide any other needed info.</p> <p><strong>---Update---</strong> I enabled the <code>javax.net.debug</code> as suggested below and the output included the following error:</p> <pre><code>java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be\ non-empty </code></pre> <p>My googling has made me think that this issue is because I'm using the following java opt when starting tomcat:</p> <pre><code>-Djavax.net.ssl.trustStore=/path/to/tomcat/conf/myStore.jks </code></pre> <p>If that's true, how can I add the things I needed in myStore.jks and not override the defaults so everyone is happy?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload