【发布时间】:2017-07-19 09:39:31
【问题描述】:
我在执行我在 .该服务需要连接到 mongodb,即使它已启动并且它在 localhost:27017 上进行侦听
以下是错误:
INFO 5 --- [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017
[main] org.mongodb.driver.cluster : No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=MULTIPLE, all=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out
【问题讨论】:
-
你能发布你的 Dockerfile 和 docker-compose.yml 如果有的话
-
嗨,wassim,我评论它是被理解的。谢谢
-
可能你在两个不同的容器中运行 mongo 和 app,奇怪的是它们每个都有自己的 localhost 版本
标签: mongodb maven docker spring-boot