com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))

DataStax JIRA | Mikhail Mazursky | 2 years ago
  1. 0

    When Cassandra is unreachable (from the start of application) I see the following exceptions: {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:196) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1104) at com.datastax.driver.core.Cluster.init(Cluster.java:121) at com.datastax.driver.core.Cluster.connect(Cluster.java:198) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} and {code:java} java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@36549757 rejected from java.util.concurrent.ThreadPoolExecutor@2c12300b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.addOrRenewPool(SessionManager.java:248) at com.datastax.driver.core.SessionManager.init(SessionManager.java:67) at com.datastax.driver.core.Cluster.connect(Cluster.java:200) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} IMHO Cluster.connect should not throw undocumented exceptions - this breaks library consumers. Looks like the cause is that com.datastax.driver.core.Cluster.Manager#init closes the thread pools in case of exception.

    DataStax JIRA | 2 years ago | Mikhail Mazursky
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))
  2. 0

    When Cassandra is unreachable (from the start of application) I see the following exceptions: {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:196) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1104) at com.datastax.driver.core.Cluster.init(Cluster.java:121) at com.datastax.driver.core.Cluster.connect(Cluster.java:198) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} and {code:java} java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@36549757 rejected from java.util.concurrent.ThreadPoolExecutor@2c12300b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.addOrRenewPool(SessionManager.java:248) at com.datastax.driver.core.SessionManager.init(SessionManager.java:67) at com.datastax.driver.core.Cluster.connect(Cluster.java:200) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} IMHO Cluster.connect should not throw undocumented exceptions - this breaks library consumers. Looks like the cause is that com.datastax.driver.core.Cluster.Manager#init closes the thread pools in case of exception.

    DataStax JIRA | 2 years ago | Mikhail Mazursky
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))
  3. 0

    How can I change which address Datastax agent will try to connect to?

    Stack Overflow | 2 years ago
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How can I change which address Datastax agent will try to connect to? - Stack Overflow

    xluat.com | 1 year ago
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))
  6. 0

    datastax,datastax-enterprise , How can I change which address Datastax agent will try to connect to?

    databasefaq.com | 11 months ago
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))

  1. kid 2 times, last 2 weeks ago
24 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.datastax.driver.core.exceptions.NoHostAvailableException

    All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))

    at com.datastax.driver.core.ControlConnection.reconnectInternal()
  2. DataStax Java Driver for Apache Cassandra - Core
    Cluster.connect
    1. com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:196)
    2. com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
    3. com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1104)
    4. com.datastax.driver.core.Cluster.init(Cluster.java:121)
    5. com.datastax.driver.core.Cluster.connect(Cluster.java:198)
    6. com.datastax.driver.core.Cluster.connect(Cluster.java:226)
    6 frames