zoukankan      html  css  js  c++  java
  • Spring boot 启动报错:com.mongodb.MongoSocketOpenException: Exception opening socket

      详细错误信息:

    com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.4.2.jar:na]
    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongodb-driver-core-3.4.2.jar:na]
    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.2.jar:na]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]


    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_131]
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_131]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_131]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_131]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_131]
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_131]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_131]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_131]
    at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongodb-driver-core-3.4.2.jar:na]
    at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.4.2.jar:na]
    ... 3 common frames omitted

    在spring boot项目中没有配置 mongodb的信息,启动一直报异常,如果使用 :

      @SpringBootApplication(exclude = MongoAutoConfiguration.class)注解取消spring boot的自动配置,项目就启动不了。

    求各位大神帮忙解答下,感激不尽。

        问题已解决,只要在配置文件里把初始的 mongodb 取消掉就好了。

  • 相关阅读:
    java文件的读写程序代码
    C#多线程总结
    动态调用WebService接口的几种方式
    Net中Attribute特性的高级使用及自定义验证实现
    进程、线程、多线程
    C#设计模式之单例模式
    C# HttpClient 请求转发
    webapi Model Validation 模型验证
    加密解密方法
    手把手教Electron+vue的使用
  • 原文地址:https://www.cnblogs.com/zhuangfei/p/7338488.html
Copyright © 2011-2022 走看看