0

After switching Spring Boot version from 2.6.7 to 2.7.0, I'm getting below error after starting the app:

Invocation of init method failed; nested exception is org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".

Can anyone help resolving this error without downgrading any SQL driver?

Sam Kadam
  • 1
  • 1

1 Answers1

0

There's a section about this in the Spring Boot 2.7 release notes:

Spring Boot 2.7 has upgrade the MSSQL driver from v9 to v10. The updated driver now enables encryption by default which may break existing applications. You can read about the change in the "Breaking Changes" section of this article.

The recommended advice is to either install a trusted certificate on your server or update your JDBC connection URL to include encrypt=false.

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242