Prematurely reached end of stream

This is my connection string

 MongoClient _client =   MongoClients.create("mongodb://" +
                          UserName + ":" + Password + "@" +
                          "sales-shard-00-00.8yajj.mongodb.net:27017," +
                          "sales-shard-00-01.8yajj.mongodb.net:27017," +
                          "sales-shard-00-02.8yajj.mongodb.net:27017/" + DbName +
                          "&authSource=admin&retryWrites=true&w=majority");

and this is the debug’s log…

I/System.out: 23:04:56.973 [main] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[sales-shard-00-00.8yajj.mongodb.net:27017, sales-shard-00-01.8yajj.mongodb.net:27017, sales-shard-00-02.8yajj.mongodb.net:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
    23:04:56.977 [main] INFO org.mongodb.driver.cluster - Adding discovered server sales-shard-00-00.8yajj.mongodb.net:27017 to client view of cluster
I/System.out: 23:04:56.994 [main] INFO org.mongodb.driver.cluster - Adding discovered server sales-shard-00-01.8yajj.mongodb.net:27017 to client view of cluster
I/System.out: 23:04:56.996 [main] INFO org.mongodb.driver.cluster - Adding discovered server sales-shard-00-02.8yajj.mongodb.net:27017 to client view of cluster
I/System.out: 23:04:57.000 [main] DEBUG org.mongodb.driver.cluster - Updating cluster description to  {type=UNKNOWN, servers=[{address=sales-shard-00-01.8yajj.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, {address=sales-shard-00-00.8yajj.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, {address=sales-shard-00-02.8yajj.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}]
I/System.out: 23:04:57.134 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-02.8yajj.mongodb.net:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:3}
I/System.out: 23:04:57.135 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-01.8yajj.mongodb.net:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:2}
I/System.out: 23:04:57.135 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-00.8yajj.mongodb.net:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:1}
I/System.out: 23:04:57.137 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-01.8yajj.mongodb.net:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server sales-shard-00-01.8yajj.mongodb.net:27017
    com.mongodb.MongoSocketReadException: Prematurely reached end of stream

and then the project stuck when i try to insert a record in a collection !
why ?

thanks
Alberto.

Is the network security of your cluster allow access from your IP address?

yes…i have 0.0.0.0/0

Can you update the driver versions? The format of the logs are from an old version.

I’m using :
implementation ‘org.mongodb:mongodb-driver:3.6.4’
and it’s seems client it’s created now…but if i try to get some collections list from my db…project stuck and close after 30000 ms. :frowning: