I have a single node GCP cluster with my spring-boot app running. I recently created a new DB [M10] cloud atlas and trying to connect it via my app. However, I keep getting the following error - screenshot attached
Is there a final “Caused by” that’s cut off from that screen shot? That could help diagnose the issue. It’s possible that you’re running into https://jira.mongodb.org/browse/JAVA-4018, in which case updating the Java driver to 4.5.1 or later will fix it.
Is this a self-managed cluster, or are using Atlas, or some other service? I am pretty sure that Atlas always registers a TXT record in DNS, but other services may not.
any idea what might be wrong? I am using the same old username/pass combination that I have for the other 2 DB [no special character] . didn’t find anything relevant online
There’s something wrong with the new Atlas DB instances. There seems to be an issue only while connecting with the new DB. The old DB connection are working perfectly fine
Notice that now the TXT record is no longer failing (that happens first) but SRV lookup is still failing. Using dig, I’m able to resolve both TXT and SRV records for this host:
If the issue was with the environment wouldn’t there be an issue connecting to other Atlas DB? [as mentioned previously, I am able to connect to the other 2 DB via the same GCP server, same application]
Not necessarily, but I don’t have a hypothesis that explains what both of us are seeing. I think at this point you should open a support ticket (https://www.mongodb.com/docs/manual/support/) to try to get to the root cause.
Having the same issue as Pranav. GCP is failing to connect, works on my local environment. GCP works when connecting to older instances of Atlas.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig' defined inURL [jar:file:/opt/app/server/app.jar!/BOOT-INF/classes!/com/devnotes/server/app/AppConfig.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.devnotes.server.app.AppConfig]: Constructor threw exception; nested exception is com.mongodb.MongoConfigurationException: Unable to look up TXT record for host dev.7f***.mongodb.net at org.springframework.beans.factory.support.ConstructorResolver.instantiate
I’m facing the same issue, but did not find any solution on the forum here which works.
I can connect to a DB on cluster0.dnqegeu.mongodb.net or cluster0.xfzokj5.mongodb.net with the MongoDB Compass application,
BUT my java spring application fails to connect to a URI with mongodb+srv://
While the mongodb driver should use the SRV entries of the DNS, it looks for a TXT entry.
The library in use is mongodb-driver-core-4.8.2.jar
Any suggestion please?
The scheme mongodb+srv involves 2 types of DNS records. A TXT record which supplied connection string parameter and SRV records which provides a list of hosts to connect to. Looking for a TXT is thus normal behaviour.