FlywaySqlException after upgrading from spring boot 2.6.7 to 2.7.0 - spring

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?

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.

Related

Redis use tls and Certificate Authority NA in Spring boot

In Redis insight:
Use TLS - checked
Certificate Authority- No CA certificate
Able to connect through redis insight software with above details by adding host, port and password.
Same thing trying in Spring boot,
In the configuration added usetls. NO CA certificate. how to configure in redis Spring boot? getting below error:
Request processing failed; nested exception is org.springframework.data.redis.RedisConnectionFail ureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to xx.xx.xx.xx: ****] with root cause
sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
I don't want to use any certificate and skip the error. As for redis insight also not used any certificate.

Spring boot and how to configure tlsAllowInvalidCertificate for MongoDB

I have a spring application that I need to connect to a MongoDB. This connection uses TLS with a self-signed certificate.
I can connect to this database without any problem using Mongo3T with the SSL protocol without PEM file.
I can connect via mongo commandline:
mongo --tls --tlsAllowInvalidCertificates mongoDB://user:pass#host:443/dbname
Without issue.
However if I configure my yml file with
spring.data.mongodb.uri : mongodb://user:pass#host:443/dbname?tls=true&tlsAllowInvalidCertificates=true
It does not connect, and I get a CertificateException:No name matching hostname.
What am I doing wrong? Could it be that tlsAllowInvalidCertificates is not supported for this driver?
Thanks

Unable to deploy spring boot application to weblogic server

Issue :
Unable to deploy Spring-Boot application in WebLogic Server.
Description
I am new to Spring boot trying to build a proxy application to route the requests to source system but having issues deploying to weblogic-12c. It's a very simple application that exposes a rest service and then redirects the received request to upstream system.
What did I try ?
Tried log4j version in pom.xml and dispatcher-servlet.xml approaches googling, I've also read the issue is b'coz of the data sources but I don't have any persistence logic and don't need a data source to be configured in weblogic.
Below is the error I am seeing, any suggestions are highly appreciated.
ERROR:
Unable to access the selected application.
Message icon - Error java.io.IOException
Message icon - Error weblogic.utils.compiler.ToolFailureException

TrustStore configuration issue in Spring feign with SSL enabled

I have two different spring boot application with SSL enabled in it and also there is an eureka discovery server and these two applications are linked to eureka server.I need to make some https call between these two SSL enabled applications. So I decided to go ahead with feign client .Eureka is able to resolve https url properly for feign client. But while making the call I'm getting "unable to find valid certification path to requested target". I can understand this error is because public key of my client application is not present in truststore of the application from which I'm making feign call. I have already added the public key in my custom truststore, But it is of no use.Property file for the same is below
server.ssl.enabled=true
server.ssl.key-store=classpath:springboot.p12
server.ssl.key-store-password= Pass#123
server.ssl.keyStoreType= PKCS12
server.ssl.keyAlias= springboot
server.ssl.trust-store=classpath:springboot.jks
server.ssl.trust-store-password=Pass#123
eureka.instance.nonSecurePortEnabled=false
eureka.instance.securePortEnabled=true
After digging more into the issue I found that "server.ssl.trust-store" property will set truststore in the embeded tomcat server of spring boot application, But some have my https call is taking default JDK truststore. When I added system properties in my application then everything is working fine. But with spring boot properties file configuration it is not working .
System.setProperty("javax.net.ssl.trustStore", trustStorePath);
System.setProperty("javax.net.ssl.trustStorePassword",trustStorePassword);
I feel setting system properties is an workaround and I'm looking for a better solution .
I even tried enabling ribbon client and added "ribbon.IsSecure=true" property also. But still getting the same issue.
Can someone please provide a suggestion for the same.
Thank you

HiKariCP for Bigquery

I am new to gcloud and trying to leverage bigquery for accessing the data. I am trying to implement a connection pooling mechanism for bigquery and found that Hikari (one of the default datasource provided by spring boot) as a viable option. Could you please guide me in setting up the Bigquery credentials in the Hikari datasource as I am not able to figure out the way to give the driver, url and credentials.
I imported the bigquery api and hikari api in my pom dependencies
FYI: I am trying to make use of springboot
I have managed to establish connection from spring boot to bigquery using simba JDBC drivers and successfully queried it.
Firstly, you need to include GCP starter dependency in your boot.
<artifactId>spring-cloud-gcp-dependencies</artifactId>
Dowload and add dependency jars of simba drivers in spring boot from the below link. Also refer installation guide in the link.
https://cloud.google.com/bigquery/docs/reference/odbc-jdbc-drivers
Secondly, create a service account that has access to bigquery and generate a key JSON file which is used to authenticate our spring boot application for connecting bigquery. Refer the below link.
https://cloud.google.com/bigquery/docs/reference/libraries#setting_up_authentication.
Lastly configure this key JSON file to be accessed by our spring book application using the simba driver JDBC installation guide.
Create a simba driver datasource and use this data source to create JDBC template bean. ( JDBC url formation is given in the installation guide of simba driver) . Thats it!! Run the application and see the results.
If you face any difficulties feel free to ask the specifics.

Resources