Home > Back-end >  Spring boot project startup error com. Mongo. MongoSocketOpenException: Exception opening the socket
Spring boot project startup error com. Mongo. MongoSocketOpenException: Exception opening the socket

Time:10-06

Spring boot directing a project integration, the parent package configuration inside the spring boot mongo, subpackage in application. The properties to configure the mongo database connection, found that connects the two database after launch, use baidu that @ SpringBootApplication (exclude=MongoAutoConfiguration. Class), it's no use annotations
Error message:
 2020-03-18 17:48:41. 632 logback [restartedMain] INFO O.S.W.S.M.M.A.R equestMappingHandlerMapping - Mapped onto "{} [/error]" public org. Springframework. HTTP. ResponseEntity Org. Springframework. Boot. Autoconfigure. Web. Servlet. Error. BasicErrorController. Error (javax.mail. Servlet. HTTP. It) 
The 2020-03-18 17:48:41. 633 logback [restartedMain] INFO O.S.W.S.M.M.A.R equestMappingHandlerMapping - Mapped "{[/error], produces=[text/HTML]}" onto public org. Springframework. Web. Servlet. ModelAndView org. Springframework. Boot. Autoconfigure. Web. Servlet. Error. BasicErrorController. ErrorHtml (javax.mail. Servlet. HTTP. It, javax.mail servlet. HTTP. HttpServletResponse)
The 2020-03-18 17:48:41. 707 logback [cluster - ClusterId {value='https://bbs.csdn.net/topics/5e71ee776710ff2fd8168bbf', the description='null'} - localhost: 27017] the INFO org. Mongo. Driver. The cluster - the Exception in the monitor thread while connecting to the server localhost: 27017
Com. The mongo. MongoSocketOpenException: Exception opening socket
At com. Mongo. Connection. SocketStream. Open (62) SocketStream. Java:
At com. Mongo. Connection. InternalStreamConnection. Open (126) InternalStreamConnection. Java:
At com. Mongo. Connection. DefaultServerMonitor $ServerMonitorRunnable. Run (114) DefaultServerMonitor. Java:
The at Java. Lang. Thread. The run (Thread. Java: 748)
Under Caused by: java.net.ConnectException: Connection refused: connect
The at java.net.DualStackPlainSocketImpl.waitForConnect (Native Method)
At java.net.DualStackPlainSocketImpl.socketConnect DualStackPlainSocketImpl. Java: (85)
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.PlainSocketImpl.connect PlainSocketImpl. Java: (172)
At java.net.SocksSocketImpl.connect SocksSocketImpl. Java: (392)
At java.net.Socket.connect (589) Socket. Java:
At com. Mongo. Connection. SocketStreamHelper. The initialize (SocketStreamHelper. Java: 59)
At com. Mongo. Connection. SocketStream. Open (SocketStream. Java: 57)
. Three common frames omitted
The 2020-03-18 17:48:41. 722 logback [restartedMain] INFO O.S.W.S.H.S impleUrlHandlerMapping - Mapped URL path/webjars/* * onto handler of type [class org. Springframework. Web. Servlet. The resource. ResourceHttpRequestHandler]
The 2020-03-18 17:48:41. 722 logback [restartedMain] INFO O.S.W.S.H.S impleUrlHandlerMapping - Mapped URL path [/*] onto handler of type [class org. Springframework. Web. Servlet. The resource. ResourceHttpRequestHandler]
The 2020-03-18 17:48:42. 328 logback [restartedMain] INFO O.S.U.F.S pringTemplateLoader - SpringTemplateLoader for FreeMarker: using the resource loader [org. Springframework. Boot. Web. Servlet. Context. AnnotationConfigServletWebServerApplicationContext @ 2918 b6d9: startup date [Wed Mar 18 17:48:28 CST 2020]; the root of the context hierarchy] and template loader path classpath:/templates/
The 2020-03-18 17:48:42. 331 logback [restartedMain] INFO O.S.W.S.V.F.F reeMarkerConfigurer - ClassTemplateLoader for Spring macros added to a FreeMarker configuration
The 2020-03-18 17:48:42. 414 logback [restartedMain] WARN O.S.B.A.F.F reeMarkerAutoConfiguration - always find a template the location (s) : the classpath:/templates/(both please add some templates, check your FreeMarker configuration, or set the spring. A FreeMarker. CheckTemplateLocation=false)
The 2020-03-18 17:48:42. 708 logback [restartedMain] INFO O.S.B.D.A.O ptionalLiveReloadServer - LiveReload server is running on port 35729
The 2020-03-18 17:48:42. 783 logback [restartedMain] INFO O.S.J.E.A.A nnotationMBeanExporter - Registering beans for JMX exposure on startup
The 2020-03-18 17:48:42. 818 logback [restartedMain] INFO O.A.C oyote. Http11. Http11NioProtocol - Starting ProtocolHandler [HTTP - nio - 9091 ""]
The 2020-03-18 17:48:42. 850 logback [restartedMain] INFO o.a.tomcat.util.net.NioSelectorPool - Using a Shared the selector for the servlet write/read
The 2020-03-18 17:48:42. 920 logback [restartedMain] INFO O.S.B.W.E.T omcat. TomcatWebServer - Tomcat started on the port (s) : 9091 (HTTP) with the context path '
The 2020-03-18 17:48:42. 930 logback [restartedMain] INFO c.com.sec.explore.ExploreApplication - Started ExploreApplication in 17.321 seconds (JVM running for 21.549)
The 2020-03-18 17:48:42. 939 logback [restartedMain] INFO c.com.sec.explore.ExploreApplication -

Is don't understand why the middle will be a connection to the local database, when should springboot mongo's own connection, but have been add annotations on start class, why doesn't work?
 @ SpringBootApplication (exclude=MongoAutoConfiguration. Class) 
@ EnableAutoConfiguration (exclude={DataSourceAutoConfiguration. Class})
Public class ExploreApplication {

nullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related