[solved] com.mongodb.MongoSocketReadException: Prematurely reached end of stream

  • Post author:
  • Post category:Bugs
  • Post comments:0 Comments
  • Post last modified:November 3, 2021
  • Reading time:1 mins read

com.mongodb.MongoSocketReadException: Prematurely reached end of stream

 

The error was solved by the format of connection (using the parameters maxIdleTimeMS, ssl and authSource):

maxIdleTimeMS – the maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed.

 

Solution: Modify the database connection like below:

spring.data.mongodb.uri=mongodb+srv://admin:[email protected]/orders?retryWrites=true&w=majority&maxIdleTimeMS=15000

 

Hope it will helps

Leave a Reply