apache/hadoop · error · ConnectionNullException

Cannot get a connection to

Error message

Cannot get a connection to {}

What it means

Router RPC client: the connection manager could not produce a connection object for the namenode address (pool exhausted or connect failed); the surrounding invokeMethod loop treats it like a per-namenode failure and moves on to the next candidate.

Solutions

  1. Verify the target namenode RPC address is correct and the namenode is running and reachable from the Router.
  2. Check Kerberos credentials/token validity on the Router for the target nameservice.
  3. Confirm network/firewall rules allow the Router to reach the namenode RPC port.
Defensive patterns

Strategy: retry

When it happens

Trigger: RouterRpcClient failed to create an RPC connection/proxy to the given namenode address.

Common situations: Namenode down, wrong RPC address in federation config, expired Kerberos ticket, or network partition between Router and a subcluster.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/e5350c77e7da20e2. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java:442

      // for each individual request.

      // TODO Add tokens from the federated UGI
      UserGroupInformation connUGI = ugi;
      if (UserGroupInformation.isSecurityEnabled() || this.enableProxyUser) {
        UserGroupInformation routerUser = UserGroupInformation.getLoginUser();
        connUGI = UserGroupInformation.createProxyUser(
            ugi.getUserName(), routerUser);
      }
      connection = this.connectionManager.getConnection(
          connUGI, rpcAddress, proto, nsId);
      LOG.debug("User {} NN {} is using connection {}",
          ugi.getUserName(), rpcAddress, connection);
    } catch (Exception ex) {
      LOG.error("Cannot open NN client to address: {}", rpcAddress, ex);
    }

    if (connection == null) {
      throw new ConnectionNullException("Cannot get a connection to "
          + rpcAddress);
    }
    return connection;
  }

  /**
   * Convert an exception to an IOException.
   *
   * For a non-IOException, wrap it with IOException. For a RemoteException,
   * unwrap it. For an IOException which is not a RemoteException, return it.
   *
   * @param e Exception to convert into an exception.
   * @return Created IO exception.
   */
  private static IOException toIOException(Exception e) {
    if (e instanceof RemoteException) {
      return ((RemoteException) e).unwrapRemoteException();
    }

View on GitHub (pinned to 2add963021)