Unable to Connect to Atlas from Application

Hi,

We are able to Connect to Atlas DB from the local shell. However, when trying to connect to the Atlas from our Application, Mongo URI doesn’t seem to establish the connection

Mongo Connection failed due to an invalid mongo server address or credentials

[2020-11-12 11:13:17,790] 63027 [qtp2052573687-51] ERROR errors  - CONNECTOR:Get_Capab:mongo:Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@c5db0d6. 

Client view of the cluster state is

{type=REPLICA_SET, servers=[{address=qwertty1-shard-00-00.uxyz.mongodb.net:27017, 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:

Mongo URI :

mdb-01-shard-00-00.uiboi.mongodb.net:27017,mdb-01-shard-00-01.uiboi.mongodb.net:27017,mdb-01-shard-00-02.uiboi.mongodb.net:27017/?replicaSet=atlas-myk-shard-0

we have created two users one master(for admin db) and another user for a newly created database. we tried with both the credentials but still not working from the Application to Atlas environment, but we are able to connect from mongo shell.
Please help.

Regards,
RK

Hi RK,

Might your application be leveraging an older driver version? What language driver are you using?

-Andrew

I had this issue when trying to use Java 8. When I switched to Java 11, the issue fully resolved.