title: SQL Server/Spring Boot: PKIX path building failed: unable to find valid certification path to requested target
body: <p>I install SQL Server on my local computer and embedd it into my Spring Boot application. After starting Tomcat I get the following error:</p>
  <p><code>'PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target'. ClientConnectionId:85411829-6853-4fdb-9373-b4c93e1d5e8f</code></p>
  <p>I know that this error is well documenteted. I followed many guides and read much about it, but all  advices I found did not fix my issue.</p>
  <p>What I had done:</p>
  <ul>
  <li><p>Download a random SSL-certificate from a website and add it to the
  cacert file in the Java directory (<a href="https://stackoverflow.com/questions/14947517/pkix-path-building-failed-sun-security-provider-certpath-suncertpathbuilderexce">descriped here</a>).</p>
  </li>
  <li><p>Configure Spring Boot for SQL Server (<a href="https://springframework.guru/configuring-spring-boot-for-microsoft-sql-server/" rel="nofollow noreferrer">descriped here</a>)</p>
  </li>
  <li><p>Configure SSL Encryption for SQL Server (<a href="https://www.mssqltips.com/sqlservertip/3299/how-to-configure-ssl-encryption-in-sql-server/" rel="nofollow noreferrer">descriped here</a>)</p>
  </li>
  </ul>
  <p>No one of these advices fixed the error. The only thing I realize is that if I set <code>spring.jpa.hibernate.ddl-auto</code> in my <code>application.properties</code> to <code>none</code> the program shows the error message, but it did not abort running.</p>
  <p>The application.properties looks like this:</p>
  <pre><code>spring.datasource.url=jdbc:sqlserver://localhost;databaseName=Car
  spring.datasource.username=admin
  spring.datasource.password=password123
  spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
  spring.jpa.hibernate.ddl-auto=none
  spring.jpa.show-sql=true
  spring.jpa.properties.hibernate.format_sql=true
  spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
  server.port=8443
  server.ssl.key-alias=selfsigned_localhost_sslserver
  server.ssl.key-password=changeit
  server.ssl.key-store=classpath:ssl-server.jks
  server.ssl.key-store-provider=SUN
  server.ssl.key-store-type=JKS
  </code></pre>
  <p>My dependencies:</p>
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.microsoft.sqlserver&lt;/groupId&gt;
          &lt;artifactId&gt;mssql-jdbc&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  <p>In SQL Server I create a database with tables and data in it.</p>
  <p>Did someone of you have an further advice how to fix this error?</p>