Unable to connect to Database mflix

When I run the connetion test to the database, it tells me something about waiting 30000 ms that matches the server.

com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@129bd55d. Client view of cluster state is {type=REPLICA_SET, servers=[{address:27017=mflix-shard-00-01.wuhp2.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, 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}}, {address:27017=mflix-shard-00-02.wuhp2.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, 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}}, {address:27017=mflix-shard-00-00.wuhp2.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, 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}}]

I have read it’s related to the value of the onnection string in the properties file:

These are the value of such file:

jwtSecret=g47wtyh6r8045gsr68jq23rfk
jwtExpirationInMs=604800000
spring.mongodb.uri=mongodb+srv://m220student:m220password@mflix.wuhp2.mongodb.net/test
spring.mongodb.database=sample_mflix
server.port=5000
server.error.whitelabel.enabled=false
logging.level.api.controllers=DEBUG
api.movies.movies_per_page=20
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/build

Are those values correct?

Your connect string looks fine.You can test yourselves from shell
It coud be JDK issue

Vote

Connection to MongoDB fails