title: unable to find a valid certification path to requested target
body: <p>I am making a post request using a restTemplate and I am getting the following error: unable to find a valid certification path to requested target</p>
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformToListClass': Invocation of init method failed; nested exception is java.lang.RuntimeException: org.springframework.web.client.ResourceAccessException: I/O error on POST request for &quot;https://emploenefitsdev/rion/v1/rion/&quot;: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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
  
  Caused by: java.lang.RuntimeException: org.springframework.web.client.ResourceAccessException: I/O error on POST request for &quot;https://emploenefitsdev/rion/v1/rion/&quot;: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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
  
  Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for &quot;https://emploenefitsdev/rion/v1/rion/&quot;: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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
  
  Caused by: 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
  
  Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  
  Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  </code></pre>
  <p>And my method below:</p>
  <pre class="lang-java prettyprint-override"><code>    public ImageDescriptor generateImage(String payLoad, String templateName, String slogPrefix) {
          try {
              ImageDescriptor descriptor = new ImageDescriptor();
  
              String myEUrl = &quot;https://emploenefitsdev/rion/v1/rion/&quot;;
              String eURL = myUrl.concat(Constant.F_SLASH).concat(templateName);
  
              log.info(&quot;payload&quot; + payLoad);
  
              ResponseEntity&lt;Resource&gt; responseEntity = restTemplate.exchange(
                      eURL,
                      HttpMethod.POST,
                      niService.getStringHttpEntityWithPayload(payLoad),
                      Resource.class);
              log.info(String.format(&quot;%s generateImage Result: [%s] &quot;, slogPrefix, responseEntity.getStatusCode()));
              descriptor.setInputStream(Objects.requireNonNull(responseEntity.getBody()).getInputStream());
  
              convert(responseEntity.getBody().getInputStream(), &quot;sherrr.pdf&quot;);
  
              log.info(&quot;file is:&quot;+ convert(responseEntity.getBody().getInputStream(), &quot;sherrr.pdf&quot;));
  
  
              return descriptor;
          } catch (IOException e) {
              e.printStackTrace();
              log.error(&quot;Error: &quot; + slogPrefix + &quot; generate image failed &quot; + e.getMessage());
              throw new RuntimeException(e);
          }
      }
  </code></pre>