Cluster description not yet available, why?

Fast asf

Hi i'm trying to run my spring boot application connected with mongo, it starts and connects to the database but as soon as I make a request from insomnia it throws these errors:

2023-05-24T10:46:37.023+02:00  INFO 21568 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-05-24T10:46:37.024+02:00  INFO 21568 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2023-05-24T10:46:37.025+02:00  INFO 21568 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 0 ms
2023-05-24T10:46:37.207+02:00  INFO 21568 --- [nio-8080-exec-1] org.mongodb.driver.cluster               : Cluster description not yet available. Waiting for 30000 ms before timing out
2023-05-24T10:47:07.222+02:00 ERROR 21568 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.3.80:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: no further information}}]] with root cause

com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.3.80:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: no further information}}]

These are my config:

@Configuration
public class MongoConfig {

    @Value("${mongo.host}")
    private String connectionString;

    @Value("${mongo.db}")
    private String db;

    @Value("${mongo.collection}")
    private String collection;

    @Bean
    public MongoCollection<Document> collection() {
        MongoClient mongoClient = create(connectionString);
        return mongoClient.getDatabase(db).getCollection(collection);
    }

properties:

mongo:
  host: ${DB_URL:mongodb://"myIpAddress":27017}
  username:
  pass:
  db: db
  collection: musica
server.port: 8080
server:
  error:
    include-message: always
    include-binding-errors: always
    include-stacktrace: never
    include-exception: false

I tried changing drivers version, checked my firewall, added auto configuration and nothing worked. Fun fact: my app works perfectly fine when is up on a Docker Container. Thx!!

Fast asf

I solved the problem, it was because of my address ip on the connection string, idk why but changing it with local host made everything work!

mongo:
  host: ${DB_URL:mongodb://localhost:27017}
  username:
  pass:
  db: db
  collection: musica
server.port: 8080
server:
  error:
    include-message: always
    include-binding-errors: always
    include-stacktrace: never
    include-exception: false

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to list all available Kafka brokers in a cluster?

Is signalr 3.0 beta available yet for 2015?

How to update Kubernetes Cluster to the latest version available?

Is there a description of all available wxPython Widgets?

Configuring highly available Redis cluster in Laravel

Why does Spark Standalone cluster not use all available cores?

Why are "Models aren't loaded yet"?

Is C++17 std::shared_mutex not available yet?

Is Win2D yet available in C++/WinRT?

Are continuations in Kotlin usable yet? Any examples available?

Google Cloud DataFlow job not available yet.. in Airflow

How to use not available yet info in later Terraform steps?

How to find available resources in a Kubernetes Cluster level?

Hostname is available yet doesn't show up in Azure Portal for purchase

iTunes Store Operation failed: Error description not available

How can I make Rasdial execute again if a connection is not yet available?

"One cluster is not yet connected to the region" after install ubuntu server?

sshd failed due to network not yet available

Why is one method working, yet another is not?

angularjs - scope property not yet available when calling link function

description The requested resource is not available

Google Search description: No information is available for this page

Why isn't an upgrade to 20.04 from 18.04 available yet?

Enumerating available actors in Akka.NET cluster

Hazelcast cluster not available on Eureka

Why sizeof succeeds on not yet exsisting variable?

Why is HttpRepl unable to find an OpenAPI description? The command "ls" does not show available endpoints

HTTP status code for resource that is not available yet

Why do processes on Linux crash if they use a lot of memory, yet still less than the amount of swap space available?