#Error:An SRV host name '`${MONGO_CLUSTER}`' was provided that does not contain at least three parts.

1 messages · Page 1 of 1 (latest)

lunar vapor
#

Can someone help me with this? I've spent hours trying to figure it out, and I'm a newbie to Java.

odd wyvernBOT
#

<@&987246527741304832> please have a look, thanks.

woven rover
#

Why do you have backticks around your cluster?

lunar vapor
#

Is there any mistake i made while connecting MongoDB?

woven rover
#

Which Spring version are you using by the way? Nowadays it's MONGO_USER and not env.and not env.MONGO_USER

lunar vapor
#

SpringBoot 3.3.4

#

still the samepeepo_cry

#

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongo' defined in class path resource [org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration.class]: Failed to instantiate [com.mongodb.client.MongoClient]: Factory method 'mongo' threw exception with message: An SRV host name '${MONGO_CLUSTER}' was provided that does not contain at least three parts. It must contain a hostname, domain name and a top level domain.

woven rover
#

And are you actually defining those?

lunar vapor
#

I suppose my CLUSTER is wrong

lunar vapor
#

Btw This is my first time working with springbootpeepo_christ

woven rover
#

I don't see spring.config.import=optional:file:.env[.properties], so did the guide tell you to use something like spring-dotenv?

lunar vapor
#

YEP

#
  • added .env in .gitignore file
woven rover
#

Please use a recent version, we're at 4.0.0.

lunar vapor
woven rover
#

Glad to hear that. There were some changes between 2 and 4.