Issue while connecting Azure cosmos DB from my spring boot application in VPN

Srivastava, Vivek K 1 Reputation point
2022-02-09T17:45:01.48+00:00

Getting bellow error--

11:58:09.399 [main] INFO org.mongodb.driver.cluster - Adding discovered server cosmos-eems.mongo.cosmos.azure.com:10255 to client view of cluster
11:58:10.991 [cluster-ClusterId{value='6200bbf96afd4b20b1355b2d', description='null'}-cosmos-eems.mongo.cosmos.azure.com:10255] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server cosmos-eems.mongo.cosmos.azure.com:10255
com.mongodb.MongoSocketWriteException: Exception sending message

Caused by: java.net.SocketException: Connection reset

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,437 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,571 Reputation points
    2022-02-10T04:34:08.907+00:00

    Hi @Srivastava, Vivek K , welcome to Microsoft Q&A forum.

    From the problem description, it seems while you are connecting your spring boot java application to Azure Cosmos DB Mango API you are facing the issue mentioned.

    I was checking on similar issue and found that this problem might not be directly due to VPN connectivity. Could you please try one of these mentioned below and let us know if this works?

    @SpringBootApplication  
    @EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})  
    

    Or

    @SpringBootApplication(exclude = {  
      MongoAutoConfiguration.class,   
      MongoDataAutoConfiguration.class  
    })  
    

    Reference Articles:
    Exception in monitor thread while connecting to server localhost:27017 while accessing MongoDB with Java
    How to disable spring-data-mongodb autoconfiguration in spring-boot

    Please let us know if this helps or else we can discuss further on the same.

    0 comments No comments