I am using spring boot and spring data mongodb to connect to a remote mongodb instance hosted by mongodb. Recently, I started to see the following exception when starting up my app locally from my windows laptop (either from eclipse, gradlew bootRun, or heroku local):
...
Caused by: com.mongodb.MongoConfigurationException: Failed looking up TXT record for host cluster0.baqtr.mongodb.net
...
Caused by: java.io.UncheckedIOException: java.net.SocketException: Network is unreachable: connect
The format of my connection string is: mongodb+srv://${MONGODB_USER_NAME}:${MONGODB_PASSWORD}@cluster0.baqtr.mongodb.net/[db name]?retryWrites=true&w=majority
The connection is fine when my app is deployed in heroku, and I am also able to connect to the db from my laptop with mongosh using the same connection string.
The only thing I can think of that coincides with the appearance of this exception is the installation of certbot, which I have now uninstalled.
Adding some details: Running: dig TXT cluster0.baqtr.mongodb.net From the heroku instance: SERVER: 10.1.0.2#53(10.1.0.2) (UDP)
From a virtualbox instance running on my laptop: SERVER: 10.1.0.2#53(10.1.0.2) (UDP)
Directly from my laptop: SERVER: 8.8.8.8#53(8.8.8.8)
I currently have my preferred and alternate DNS servers set on the wifi network connection, ipv4 to 8.8.8.8 and 8.8.4.4 respectively (again, this is set through windows settings).
However, when I run ipconfig: Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : hsd1.ca.comcast.net
I also have been able to workaround the problem (so far) by setting a VM argument in my run configuration in eclipse: -Djava.naming.provider.url="dns://8.8.8.8"
I'm wondering if windows is overriding my manual dns config of 8.8.8.8 with the comcast dns, and the comcast dns is blocking my lookup of cluster0?