Can't connect to mongodb

I can successfully connect using ‘mongo “my URL from Atlas”’
but when I paste that url into the application.properties file for spring.mongodb.uri:
and run the connectionsTest or try and run the application I get:

Timed out after 30000 ms while waiting for a server that matches
com.mongodb.client.internal.MongoClientDelegate$1@680a66dd.
Client view of cluster state is {type=REPLICA_SET, servers=[{address:27017=mflix-shard-00-01-hxo9q.mongodb.net,
type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message},
caused by {javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:
No subject alternative names matching IP address 3.219.235.221 found},
caused by {java.security.cert.CertificateException: No subject alternative names matching IP address 3.219.235.221 found}},
{address:27017=mflix-shard-00-02-hxo9q.mongodb.net, type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketWriteException: Exception sending message},
caused by {javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:
No subject alternative names matching IP address 3.208.67.90 found},
caused by {java.security.cert.CertificateException: No subject alternative names matching IP address 3.208.67.90 found}},
{address:27017=mflix-shard-00-00-hxo9q.mongodb.net, type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketWriteException: Exception sending message},
caused by {javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:
No subject alternative names matching IP address 52.201.11.125 found},
caused by {java.security.cert.CertificateException: No subject alternative names matching IP address
52.201.11.125 found}}]

Please check our forums
Check your uri or you may need to upgrade JDK

1 Like