已解决com.mongodb.MongoSocketOpenException: Exception opening socket
Posted up up!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了已解决com.mongodb.MongoSocketOpenException: Exception opening socket相关的知识,希望对你有一定的参考价值。
启动SpringBoot项目时,报错如下信息
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:67)
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64)
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62)
… 3 common frames omitted
解决方法:
在SpringBoot项目的启动类上添加
@SpringBootApplication(exclude = MongoAutoConfiguration.class)
以上是关于已解决com.mongodb.MongoSocketOpenException: Exception opening socket的主要内容,如果未能解决你的问题,请参考以下文章