---
title: "Exception in monitor thread while connecting to server localhost:27017"
description: "When running in the IDE, if you get an error during startup that looks like this: ![](https://namazustudios.com/wp-content/uploads/2026/01/Screenshot-2026-01-30-at-11.31.36-AM-1024x247.png) ``` [main] INFO d.g.e.d.m.p.MongoClientProvider - Using Connection String mongodb://localhost [cluster-ClusterId{value='697d0682597b1a49061a2baa', description='null'}-localhost:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server localhost:27017…"
url: "https://namazustudios.com/docs/troubleshooting-guide/community-edition/running-in-the-ide/exception-in-monitor-thread-while-connecting-to-server-localhost27017/"
updated: "2026-08-13"
category: Troubleshooting / Namazu Elements Community Edition / Running in the IDE
---

# Exception in monitor thread while connecting to server localhost:27017

When running in the IDE, if you get an error during startup that looks like this:

![](https://namazustudios.com/wp-content/uploads/2026/01/Screenshot-2026-01-30-at-11.31.36-AM-1024x247.png)

```
[main] INFO  d.g.e.d.m.p.MongoClientProvider - Using Connection String mongodb://localhost
[cluster-ClusterId{value='697d0682597b1a49061a2baa', description='null'}-localhost:27017] INFO  org.mongodb.driver.cluster - Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
...
Caused by: java.net.ConnectException: Connection refused
```

then you likely don't have a mongodb container running. Mongo is the database that Elements uses, and Elements attempts to make a connection to a local instance running at the default mongo port (27017).

If you've already run mongo before using the `Docker compose up` command that you previously used, or via [Docker](https://namazustudios.com/glossary/docker/) Desktop.

![](https://namazustudios.com/wp-content/uploads/2026/01/Screenshot-2026-01-30-at-11.43.30-AM-1024x419.png)

Warning

If you have multiple instances of mongo, make sure that you run the same one each time for data consistency.

There are a few ways to get mongo running if you haven't already. Since you're running in the IDE, it's probably safe to assume that you have either the [Elements source project](https://github.com/NamazuStudios/elements) or the [example element project](https://github.com/NamazuStudios/element-example) (or some other custom [Element](https://namazustudios.com/glossary/element/) project). Included in these is a services-dev folder ([source](https://github.com/NamazuStudios/elements/tree/main/docker-config/services-dev) / [example](https://github.com/NamazuStudios/element-example/tree/main/services-dev)) with a [Docker](https://namazustudios.com/glossary/docker/) compose file that will fetch and run mongo for you.
