Ticket: Database Connection

Getting below error

com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@604d23fa. Client view of cluster state is {type=REPLICA_SET, servers=[{address:27017=cluster0-shard-00-02-cbazo.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address:27017=cluster0-shard-00-00-cbazo.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address:27017=cluster0-shard-00-01-cbazo.mongodb.net, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}]

Seems like a network issue. Can you try to connect to mongo shell directly?

Kanika

From shell I am able to connect without any issue.
Initially i was getting ssl error.
I fixed that by adding ssl=false param in uri.
After that i am getting the above stated error.

It will not work without ssl. Can you share the error without this argument.

Kanika

javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names matching IP address

Hi @Tamal_41454,

You might need to upgrade JDK to make it work. Found this in the forums:

Kanika

Yes, You are right. I was using java 1.8.x.
Upgrading jdk version to 11 solves the problem.

1 Like