sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

1,474 views
Skip to first unread message

Shachar Grembek

unread,
Jan 15, 2018, 3:55:02 AM1/15/18
to Google App Engine
Hi,

I am using App Engine java 8 that exposes a few HTTPS GET API's. When I test my API from the browser it works perfectly, but when I create a java client from code that calls the API I receive an exception:
" sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

I don't know why am I receiving the exception as I have yet set any security measures and more surprisingly, the call works fine with my browser. 

This is the code I am using for the java client:
Any ideas why is it happening?

URL myUrl = new URL(httpsURL);
HttpsURLConnection conn = (HttpsURLConnection) myUrl.openConnection();
conn.setRequestMethod("GET");
InputStream is = conn.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);

String inputLine;

while ((inputLine = br.readLine()) != null) {
System.out.println(inputLine);
}

br.close();

Kenworth (Google Cloud Platform)

unread,
Jan 15, 2018, 11:26:35 AM1/15/18
to Google App Engine
This seems to be a dated known issue about the need to generate the certificates. You can find one of the blogs here

For further assistance I would recommend posting a question to StackOverflow (which we also monitor), as this falls outside the scope of Google Groups which is not meant for specific 1-on-1 technical issues but for general discussion of the platform and its services. Check out our community support page for the list of tags we monitor.


Reply all
Reply to author
Forward
0 new messages