com.mongodb.MongoSocketOpenException

tip

Check if your MongoDB is available.


rprp
tip

host port isnt set

tip

To restart the Selenium Webdriver mock browser in a testcase, first use 'driver.close()' and then reinstantiate the driver.

tip

Firewall might be blocking your connection, or MySQL it's not running on your server machine.


rafaelrafael
tip

Check if you have started your server, or if your server is set to listen to the port you're trying to connect and is waiting to accept connections and check if the firewall isn't blocking your connection.


rafaelrafael
tip

Check if ip adress is correct, if the port is correct, and if the server is up and running and waiting for connections. Also, check if there's no firewall blocking you and if your internet connection is working.


rafaelrafael
tip

spring-data-redis requires redis 2.6+ to work properly.

tip

Check if your server (or a proxy server) is not going up and down. There might be something between a proxy and a client sending intermittent requests to non-functioning hosts as well. There might as well be too many requests in a short amount of time.

tip

Check if your server (or a proxy server) is not going up and down. There might be something between a proxy and a client sending intermittent requests to non-functioning hosts as well. There might as well be too many requests in a short amount of time.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • I want to build a web application on Heroku, I can connect to mongodb, because I tried to create a collection in the Main.java, and it worked. There is the error message: {code} 6:47:08 PM web.1 | [main] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[ds015869.mlab.com:15869], mode=SINGLE, requiredClusterTy… 6:47:08 PM web.1 | [main] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNO… 6:47:08 PM web.1 | [cluster-ClusterId{value='56fda8ece1a1e38897e615c5', description='null'}-127.0.0.1:27017] INFO org.mongodb.driver.cluster - Exception i… 6:47:08 PM web.1 | com.mongodb.MongoSocketOpenException: Exception opening socket 6:47:08 PM web.1 | at com.mongodb.connection.SocketStream.open(SocketStream.java:63) 6:47:08 PM web.1 | at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) 6:47:08 PM web.1 | at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) 6:47:08 PM web.1 | at java.lang.Thread.run(Thread.java:745) 6:47:08 PM web.1 | Caused by: java.net.ConnectException: Connection refused 6:47:08 PM web.1 | at java.net.PlainSocketImpl.socketConnect(Native Method) 6:47:08 PM web.1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) 6:47:08 PM web.1 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) 6:47:08 PM web.1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) 6:47:08 PM web.1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 6:47:08 PM web.1 | at java.net.Socket.connect(Socket.java:589) 6:47:08 PM web.1 | at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) 6:47:08 PM web.1 | at com.mongodb.connection.SocketStream.open(SocketStream.java:58) 6:47:08 PM web.1 | ... 3 more 6:47:08 PM web.1 | [main] INFO org.mongodb.driver.cluster - No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UN… 6:47:09 PM web.1 | [cluster-ClusterId{value='56fda8ece1a1e38897e615c4', description='null'}-ds015869.mlab.com:15869] INFO org.mongodb.driver.connection - … 6:47:09 PM web.1 | [cluster-ClusterId{value='56fda8ece1a1e38897e615c4', description='null'}-ds015869.mlab.com:15869] INFO org.mongodb.driver.cluster - Mon… 6:47:09 PM web.1 | {code}
    via by Junwei Zhuge,
  • I want to build a web application on Heroku, I can connect to mongodb, because I tried to create a collection in the Main.java, and it worked. There is the error message: {code} 6:47:08 PM web.1 | [main] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[ds015869.mlab.com:15869], mode=SINGLE, requiredClusterTy… 6:47:08 PM web.1 | [main] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNO… 6:47:08 PM web.1 | [cluster-ClusterId{value='56fda8ece1a1e38897e615c5', description='null'}-127.0.0.1:27017] INFO org.mongodb.driver.cluster - Exception i… 6:47:08 PM web.1 | com.mongodb.MongoSocketOpenException: Exception opening socket 6:47:08 PM web.1 | at com.mongodb.connection.SocketStream.open(SocketStream.java:63) 6:47:08 PM web.1 | at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) 6:47:08 PM web.1 | at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) 6:47:08 PM web.1 | at java.lang.Thread.run(Thread.java:745) 6:47:08 PM web.1 | Caused by: java.net.ConnectException: Connection refused 6:47:08 PM web.1 | at java.net.PlainSocketImpl.socketConnect(Native Method) 6:47:08 PM web.1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) 6:47:08 PM web.1 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) 6:47:08 PM web.1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) 6:47:08 PM web.1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 6:47:08 PM web.1 | at java.net.Socket.connect(Socket.java:589) 6:47:08 PM web.1 | at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) 6:47:08 PM web.1 | at com.mongodb.connection.SocketStream.open(SocketStream.java:58) 6:47:08 PM web.1 | ... 3 more 6:47:08 PM web.1 | [main] INFO org.mongodb.driver.cluster - No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UN… 6:47:09 PM web.1 | [cluster-ClusterId{value='56fda8ece1a1e38897e615c4', description='null'}-ds015869.mlab.com:15869] INFO org.mongodb.driver.connection - … 6:47:09 PM web.1 | [cluster-ClusterId{value='56fda8ece1a1e38897e615c4', description='null'}-ds015869.mlab.com:15869] INFO org.mongodb.driver.cluster - Mon… 6:47:09 PM web.1 | {code}
    via by Junwei Zhuge,
  • I have tried the following in an application.yml (from spring-cloud-config), as well as a -D system parameter on startup AND bootstrap.yml to no avail {code} spring.data.mongodb.uri: "mongodb://192.168.1.11:27017/mydb" {code} Yet I keep seeing this in the logs about connecting to 127.0.0.1 and the app fails to boot: {code} 2016-08-23 22:01:01,737 ggsandbox 39380 me-security [t=,s=,se=] INFO [PostProcessorRegistrationDelegate$BeanPostProcessorChecker] Bean 'org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration' of type [class org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration$$EnhancerBySpringCGLIB$$3f8ca239] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-23 22:01:01,821 ggsandbox 39380 me-security [t=,s=,se=] INFO [cluster] Cluster created with settings {hosts=[localhost:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} 2016-08-23 22:01:01,821 ggsandbox 39380 me-security [t=,s=,se=] INFO [cluster] Adding discovered server localhost:27017 to client view of cluster 2016-08-23 22:01:01,830 ggsandbox 39380 me-security [t=,s=,se=] DEBUG [mbeanserver] ObjectName = org.mongodb.driver:type=ConnectionPool,clusterId=57bcc79d80155499d4df075b,host=localhost,port=27017 2016-08-23 22:01:01,830 ggsandbox 39380 me-security [t=,s=,se=] DEBUG [mbeanserver] name = org.mongodb.driver:type=ConnectionPool,clusterId=57bcc79d80155499d4df075b,host=localhost,port=27017 2016-08-23 22:01:01,830 ggsandbox 39380 me-security [t=,s=,se=] DEBUG [mbeanserver] Send create notification of object org.mongodb.driver:clusterId=57bcc79d80155499d4df075b,host=localhost,port=27017,type=ConnectionPool 2016-08-23 22:01:01,830 ggsandbox 39380 me-security [t=,s=,se=] DEBUG [mbeanserver] JMX.mbean.registered org.mongodb.driver:type=ConnectionPool,clusterId=57bcc79d80155499d4df075b,host=localhost,port=27017 2016-08-23 22:01:01,849 ggsandbox 39380 me-security [t=,s=,se=] INFO [cluster] 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) at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.ConnectException: 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.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ... 3 common frames omitted {code} The only way I can get it to work is with {code} spring.data.mongodb.host|port{code} in bootstrap.yml or on the command line with -D. Nothing seems to work w/ spring-cloud-config based mongo settings
    via by bitsofinfo,
  • GitHub comment 144#249810782
    via GitHub by schorke
    ,
  • Dashboard.properties
    via GitHub by shilpsl1
    ,
    • com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.SocketStream.open(SocketStream.java:63) at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.ConnectException: 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.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ... 3 more

    Users with the same issue

    rprp
    5 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    johnxflyjohnxfly
    5 times, last one,
    AxeloAxelo
    2 times, last one,
    rocdayrocday
    2 times, last one,
    479 more bugmates