apache/hadoop · critical · ServerException

S14

S14

Error message

Could not initialize server, {0}

What it means

After both bootstrap properties are present, ServerWebApp.resolveAuthority() resolves the hostname with InetAddress.getByName(host). Error S14 ('Could not initialize server') is thrown when that throws UnknownHostException - the configured httpfs.http.hostname value cannot be resolved to an address - and webapp startup aborts with ex.toString() as parameter {0}.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/servlet/ServerWebApp.java:196

   *         if any of the above 2 properties is not defined.
   */
  protected InetSocketAddress resolveAuthority() throws ServerException {
    String hostnameKey = getName() + HTTP_HOSTNAME;
    String portKey = getName() + HTTP_PORT;
    String host = System.getProperty(hostnameKey);
    String port = System.getProperty(portKey);
    if (host == null) {
      throw new ServerException(ServerException.ERROR.S13, hostnameKey);
    }
    if (port == null) {
      throw new ServerException(ServerException.ERROR.S13, portKey);
    }
    try {
      InetAddress add = InetAddress.getByName(host);
      int portNum = Integer.parseInt(port);
      return new InetSocketAddress(add, portNum);
    } catch (UnknownHostException ex) {
      throw new ServerException(ServerException.ERROR.S14, ex.toString(), ex);
    }
  }

  /**
   * Destroys the <code>ServletContextListener</code> which destroys
   * the Server.
   *
   * @param event servelt context event.
   */
  @Override
  public void contextDestroyed(ServletContextEvent event) {
    destroy();
  }

  /**
   * Returns the hostname:port InetSocketAddress the webserver is listening to.
   *
   * @return the hostname:port InetSocketAddress the webserver is listening to.

View on GitHub (pinned to 2add963021)

Solutions

  1. Verify resolution on the httpfs host: getent hosts <configured-hostname>
  2. Fix DNS or add the hostname to /etc/hosts, or change httpfs.http.hostname to a resolvable name or a literal IP
  3. Use 0.0.0.0 to bind all interfaces when you do not need a specific address
  4. Restart the servlet container after the change

Example fix

# before
-Dhttpfs.http.hostname=htpfs.example.com   # typo, unresolvable -> S14

# after
-Dhttpfs.http.hostname=httpfs.example.com   # resolvable, or use 0.0.0.0
Defensive patterns

Strategy: validation

Validate before calling

String host = System.getProperty("httpfs.http.hostname", "0.0.0.0");
try {
  java.net.InetAddress.getByName(host); // UnknownHostException here, before server start
} catch (java.net.UnknownHostException ex) {
  throw new IllegalStateException("httpfs.http.hostname unresolvable: " + host, ex);
}

Try / catch

try {
  serverWebApp.contextInitialized(event);
} catch (ServerException ex) {
  if (ex.getError() == ServerException.ERROR.S14) {
    // UnknownHostException chained: hostname cannot be resolved on this host
    log.error("cannot resolve httpfs.http.hostname: {}", ex.getCause());
  }
  throw ex;
}

Prevention

When it happens

Trigger: httpfs.http.hostname set to a hostname that DNS/hosts cannot resolve (typo, stale name, hostname only resolvable inside another network zone); InetAddress.getByName throws UnknownHostException during contextInitialized.

Common situations: Setting httpfs.http.hostname to a fully qualified cluster name that the httpfs host's resolver does not know; /etc/hosts or DNS changed after configuration; running in a container/network namespace where the configured name is unresolvable.

Related errors


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