title: Can't access Buckets on S3 using AWS S3 Java API using HTTPS
body: <p>Trying to access our local S3 storage I first ran into a problem with a missing certificate:</p>
  
  <blockquote>
    <p>Exception in thread "main" com.amazonaws.SdkClientException: Unable to
    execute HTTP request: sun.security.validator.ValidatorException: PKIX
    path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to
    find valid certification path to requested target</p>
  </blockquote>
  
  <p>Switching the cert checking off:</p>
  
  <blockquote>
    <p>System.setProperty(SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY,
    "true");</p>
  </blockquote>
  
  <p>I managed 'connecting' to the server. But this doesn't yield any results (aka an empty list), using the code below. Pretty simple so far.</p>
  
  <p>Both the endpoint, as well as the bucket name should be correct, as I cut'n'pastedd them out of my (working) S3 browser.</p>
  
  <p>Credentials seem to be correct, too, as I'm running in a 404 when I mess those up. Again - copied those from y S3 broswer.</p>
  
  <p>Using the S3 browser, I can access the bucket, add files an so on.</p>
  
  <p>When running <code>List&lt;Bucket&gt; buckets = s3Client.listBuckets();</code> it simply returns an empty list - without any exception.</p>
  
  <p>Console output is:</p>
  
  <blockquote>
    <p>Juli 03, 2019 8:48:07 NACHM. com.amazonaws.http.AmazonHttpClient
    createSocketFactoryRegistry WARNUNG: SSL Certificate checking for
    endpoints has been explicitly disabled. Juli 03, 2019 8:48:08 NACHM.
    com.amazonaws.auth.profile.internal.BasicProfileConfigLoader
    loadProfiles WARNUNG: Your profile name includes a 'profile ' prefix.
    This is considered part of the profile name in the Java SDK, so you
    will need to include this prefix in your profile name when you
    reference this profile from your Java code. Juli 03, 2019 8:48:08
    NACHM. com.amazonaws.auth.profile.internal.BasicProfileConfigLoader
    loadProfiles WARNUNG: Your profile name includes a 'profile ' prefix.
    This is considered part of the profile name in the Java SDK, so you
    will need to include this prefix in your profile name when you
    reference this profile from your Java code. Juli 03, 2019 8:48:23
    NACHM. com.amazonaws.http.AmazonHttpClient createSocketFactoryRegistry
    WARNUNG: SSL Certificate checking for endpoints has been explicitly
    disabled.</p>
  </blockquote>
  
  <p>Any advice?             </p>
  
  <pre><code>System.setProperty(SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY, "true");
          String accessKey = "myaccess";
          String secretKey = "mysecret";
  
          AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
          ClientConfiguration clientConfig = new ClientConfiguration();
          clientConfig.setProtocol(Protocol.HTTPS);
  
          EndpointConfiguration endpointConfig = new EndpointConfiguration("endpoint.com", Regions.EU_CENTRAL_1.getName());
          AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                  .withCredentials(new AWSStaticCredentialsProvider(credentials))
                  //.withRegion(defaultRegion)
                  .withEndpointConfiguration(endpointConfig)
                  .build();
  
          List&lt;Bucket&gt; buckets = s3Client.listBuckets();
          for (Bucket bucket : buckets) { 
                  System.out.println(
                          bucket.getName() + 
                          "\t" +
                          StringUtils.fromDate(bucket.getCreationDate())
                  );
          }
  </code></pre>
  
  <p>When running <code>List&lt;Bucket&gt; buckets = s3Client.listBuckets();</code> it simply returns an empty list - without any exception.</p>
  
  <p>There are (according to the S3 browser) 2 files in this bucket's root.</p>
  
  <p>Console output is:</p>
  
  <blockquote>
    <p>Juli 03, 2019 8:48:07 NACHM. com.amazonaws.http.AmazonHttpClient
    createSocketFactoryRegistry WARNUNG: SSL Certificate checking for
    endpoints has been explicitly disabled. Juli 03, 2019 8:48:08 NACHM.
    com.amazonaws.auth.profile.internal.BasicProfileConfigLoader
    loadProfiles WARNUNG: Your profile name includes a 'profile ' prefix.
    This is considered part of the profile name in the Java SDK, so you
    will need to include this prefix in your profile name when you
    reference this profile from your Java code. Juli 03, 2019 8:48:08
    NACHM. com.amazonaws.auth.profile.internal.BasicProfileConfigLoader
    loadProfiles WARNUNG: Your profile name includes a 'profile ' prefix.
    This is considered part of the profile name in the Java SDK, so you
    will need to include this prefix in your profile name when you
    reference this profile from your Java code. Juli 03, 2019 8:48:23
    NACHM. com.amazonaws.http.AmazonHttpClient createSocketFactoryRegistry
    WARNUNG: SSL Certificate checking for endpoints has been explicitly
    disabled.</p>
  </blockquote>
  
  <p>Any advice?</p>