openzipkin/zipkin · error · NullPointerException

contactPoints == null

Error message

contactPoints == null

What it means

CassandraStorageBuilder.contactPoints(String) throws NullPointerException ('contactPoints == null') when the comma-separated Cassandra contact-point string is null. Contact points bootstrap the driver session; null means the value was never supplied, and the builder requires it (or you keep the default 'localhost').

Source

Thrown at zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraStorageBuilder.java:100

    if (autocompleteTtl <= 0) throw new IllegalArgumentException("autocompleteTtl <= 0");
    this.autocompleteTtl = autocompleteTtl;
    return (B) this;
  }

  @Override public B autocompleteCardinality(int autocompleteCardinality) {
    if (autocompleteCardinality <= 0) {
      throw new IllegalArgumentException("autocompleteCardinality <= 0");
    }
    this.autocompleteCardinality = autocompleteCardinality;
    return (B) this;
  }

  /**
   * Comma separated list of host addresses part of Cassandra cluster. You can also specify a custom
   * port with 'host:port'. Defaults to localhost on port 9042 *
   */
  public B contactPoints(String contactPoints) {
    if (contactPoints == null) throw new NullPointerException("contactPoints == null");
    this.contactPoints = contactPoints;
    return (B) this;
  }

  /**
   * Name of the datacenter that will be considered "local" for latency load balancing. When unset,
   * load-balancing is round-robin.
   */
  public B localDc(String localDc) {
    if (localDc == null) throw new NullPointerException("localDc == null");
    this.localDc = localDc;
    return (B) this;
  }

  /** Max pooled connections per datacenter-local host. Defaults to 8 */
  public B maxConnections(int maxConnections) {
    if (maxConnections <= 0) throw new IllegalArgumentException("maxConnections <= 0");
    this.poolLocalSize = maxConnections;

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Pass a valid contact string, e.g. contactPoints("host1:9042,host2:9042")
  2. Default null config values to "localhost" before calling the builder
  3. Add the missing env var / property to the deployment

Example fix

// before
String hosts = System.getenv("CASSANDRA_HOSTS"); // null
builder.contactPoints(hosts);

// after
String hosts = System.getenv("CASSANDRA_HOSTS");
builder.contactPoints(hosts != null ? hosts : "localhost");
Defensive patterns

Strategy: validation

Validate before calling

String contactPoints = System.getenv("CASSANDRA_HOSTS");
builder.contactPoints(contactPoints != null ? contactPoints : "localhost");

Prevention

When it happens

Trigger: Calling contactPoints(null), or passing a null value sourced from an env var/property that was never set (e.g. System.getenv("CASSANDRA_HOSTS") returning null).

Common situations: Deployment manifests missing the CASSANDRA_HOSTS/zipkin.storage.cassandra.contact-points variable; local runs assuming a default was applied by the builder (it is not — only server-side property binding applies defaults).

Related errors


AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14). Data as JSON: /api/errors/27769c0b0f73df77. Report an issue: GitHub.