mongoDB java 连接报错。但是我并没有调用连接部分的代码,打断点我项目中的关于mongo的也没有执行。

这是报错代码。能看出问题在哪么

[INFO] 2017-01-18 10:13:15 org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer 159 : Tomcat started on port(s): 8080 (http)
[INFO] 2017-01-18 10:13:16 org.mongodb.driver.cluster 76 : Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongo-java-driver-3.2.2.jar:na]
    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) ~[mongo-java-driver-3.2.2.jar:na]
    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) ~[mongo-java-driver-3.2.2.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_101]
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_101]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_101]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_101]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_101]
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_101]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_101]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_101]
    at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) ~[mongo-java-driver-3.2.2.jar:na]
    at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongo-java-driver-3.2.2.jar:na]
    ... 3 common frames omitted
凤凰求蛊
浏览 444回答 3
3回答

沧海一幻觉

如果没有连接mongodb的话看看是不是项目里面放了mongodb的jar包,或者Tomcat下还有其它项目

梵蒂冈之花

请问楼主解决了问题没有?小弟也遇到了相同的问题
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java