com.mongodb.MongoException: host and port should be specified in host:port format

GitHub | DeeeFOX | 4 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    [Bug] When using on Spark2.x with hadoop 2.7.x, Error occur as following

    GitHub | 4 months ago | DeeeFOX
    com.mongodb.MongoException: host and port should be specified in host:port format
  2. 0

    [Bug] When using on Spark2.x with hadoop 2.7.x, Error occur as following

    GitHub | 4 months ago | DeeeFOX
    com.mongodb.MongoException: host and port should be specified in host:port format
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Constructing a {{ServerAddress}} using IPv6 {{InetAddress}} fails if the specified IP address resolves to its address (i.e. no reverse host mapping). {{ServerAddress}} assumes that IPv6 addresses are always specified in brackets which isn't the case for IPv6 addresses without reverse host mapping. Stack trace: {code} com.mongodb.MongoException: host and port should be specified in host:port format at com.mongodb.ServerAddress.<init>(ServerAddress.java:122) at com.mongodb.ServerAddress.<init>(ServerAddress.java:58) {code} Test case: {code:java} import static org.junit.Assert.*; import java.net.InetAddress; import org.junit.Test; import com.mongodb.ServerAddress; public class ServerAddressUnitTests { @Test public void hostAndPortStringIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress("[dead:beef:affe::1]:27017"); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } @Test public void hostAndPortIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress("[dead:beef:affe::1]", 27017); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } @Test public void inetAddressIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress(InetAddress.getByName("dead:beef:affe::1")); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } @Test public void inetAddressAndPortIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress(InetAddress.getByName("dead:beef:affe::1"), 27017); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } } {code}

    JIRA | 8 months ago | Mark Paluch
    com.mongodb.MongoException: host and port should be specified in host:port format
  5. 0

    Constructing a {{ServerAddress}} using IPv6 {{InetAddress}} fails if the specified IP address resolves to its address (i.e. no reverse host mapping). {{ServerAddress}} assumes that IPv6 addresses are always specified in brackets which isn't the case for IPv6 addresses without reverse host mapping. Stack trace: {code} com.mongodb.MongoException: host and port should be specified in host:port format at com.mongodb.ServerAddress.<init>(ServerAddress.java:122) at com.mongodb.ServerAddress.<init>(ServerAddress.java:58) {code} Test case: {code:java} import static org.junit.Assert.*; import java.net.InetAddress; import org.junit.Test; import com.mongodb.ServerAddress; public class ServerAddressUnitTests { @Test public void hostAndPortStringIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress("[dead:beef:affe::1]:27017"); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } @Test public void hostAndPortIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress("[dead:beef:affe::1]", 27017); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } @Test public void inetAddressIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress(InetAddress.getByName("dead:beef:affe::1")); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } @Test public void inetAddressAndPortIPv6AddressShouldWork() throws Exception { ServerAddress serverAddress = new ServerAddress(InetAddress.getByName("dead:beef:affe::1"), 27017); assertEquals(27017, serverAddress.getPort()); assertEquals("dead:beef:affe::1", serverAddress.getHost()); } } {code}

    JIRA | 8 months ago | Mark Paluch
    com.mongodb.MongoException: host and port should be specified in host:port format

    Root Cause Analysis

    1. com.mongodb.MongoException

      host and port should be specified in host:port format

      at com.mongodb.ServerAddress.<init>()
    2. MongoDB Java Driver
      ServerAddress.<init>
      1. com.mongodb.ServerAddress.<init>(ServerAddress.java:95)
      2. com.mongodb.ServerAddress.<init>(ServerAddress.java:53)
      2 frames
    3. com.stratio.datasource
      MongodbClientActor$$anonfun$receive$1.applyOrElse
      1. com.stratio.datasource.mongodb.client.MongodbClientActor.com$stratio$datasource$mongodb$client$MongodbClientActor$$doGetClient(MongodbClientActor.scala:108)
      2. com.stratio.datasource.mongodb.client.MongodbClientActor$$anonfun$receive$1.applyOrElse(MongodbClientActor.scala:45)
      2 frames
    4. Akka Actor
      Actor$class.aroundReceive
      1. akka.actor.Actor$class.aroundReceive(Actor.scala:467)
      1 frame
    5. com.stratio.datasource
      MongodbClientActor.aroundReceive
      1. com.stratio.datasource.mongodb.client.MongodbClientActor.aroundReceive(MongodbClientActor.scala:34)
      1 frame
    6. Akka Actor
      ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec
      1. akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
      2. akka.actor.ActorCell.invoke(ActorCell.scala:487)
      3. akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
      4. akka.dispatch.Mailbox.run(Mailbox.scala:220)
      5. akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
      5 frames
    7. Scala
      ForkJoinWorkerThread.run
      1. scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
      2. scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
      3. scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
      4. scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
      4 frames