Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8210002

JDK 11 fails to connect to www.googleapis.com

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Request works in JDK10, but fails in JDK11

      REGRESSION : Last worked in version 11

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run jshell, use java.net.httpclient

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Returns response for http request
      ACTUAL -
      Fails to connect

      ---------- BEGIN SOURCE ----------
      $ /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/jshell
      | Welcome to JShell -- Version 11-ea
      | For an introduction type: /help intro

      jshell> import java.net.URI;

      jshell> import java.net.http.HttpClient;

      jshell> import java.net.http.HttpRequest;

      jshell> import java.net.http.HttpResponse;

      jshell>

      jshell> import static java.net.http.HttpResponse.BodyHandlers.ofString;

      jshell> HttpClient client = HttpClient.newHttpClient();
      client ==> jdk.internal.net.http.HttpClientImpl@55040f2f(1)

      jshell> HttpRequest request = HttpRequest.newBuilder().uri(URI.create("https://www.googleapis.com/robots.txt")).build();
      request ==> https://www.googleapis.com/robots.txt GET

      jshell> client.sendAsync(request, ofString()).thenApply(HttpResponse::body).thenAccept(System.out::println).join();
      | Exception java.util.concurrent.CompletionException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      ---------- END SOURCE ----------

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: