Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2161

com.mongodb.MongoSocketOpenException: Exception opening socket

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mac osX, Heroku

      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:

      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 |
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            zhugerock@gmail.com Junwei Zhuge
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: