openzipkin/zipkin · warning · NullPointerException
logger == null
Error message
logger == null
What it means
Defensive re-check in Collector's package-private constructor: the builder's logger must not be null. In practice unreachable through Collector.newBuilder(Class) because that entry point creates the logger from a non-null class; the guard protects against future/alternate construction paths and bugs in the builder itself.
Source
Thrown at zipkin-collector/core/src/main/java/zipkin2/collector/Collector.java:89
/** Sets {@link {@link CollectorComponent.Builder#sampler(CollectorSampler)}} */
public Builder sampler(CollectorSampler sampler) {
if (sampler == null) throw new NullPointerException("sampler == null");
this.sampler = sampler;
return this;
}
public Collector build() {
return new Collector(this);
}
}
final Logger logger;
final CollectorMetrics metrics;
final CollectorSampler sampler;
final StorageComponent storage;
Collector(Builder builder) {
if (builder.logger == null) throw new NullPointerException("logger == null");
this.logger = builder.logger;
this.metrics = builder.metrics == null ? CollectorMetrics.NOOP_METRICS : builder.metrics;
if (builder.storage == null) throw new NullPointerException("storage == null");
this.storage = builder.storage;
this.sampler = builder.sampler == null ? CollectorSampler.ALWAYS_SAMPLE : builder.sampler;
}
public void accept(List<Span> spans, Callback<Void> callback) {
accept(spans, callback, Runnable::run);
}
/**
* Calls to get the storage component could be blocking. This ensures requests that block
* callers (such as http or gRPC) do not add additional load during such events.
*
* @param executor the executor used to enqueue the storage request.
*/
public void accept(List<Span> spans, Callback<Void> callback, Executor executor) {View on GitHub (pinned to 878ce2a1fa)
Solutions
- Use the public entry point Collector.newBuilder(YourCollectorClass.class) which always sets a logger.
- If you forked the builder, ensure the logger field is final and set in the constructor.
Defensive patterns
Strategy: validation
Prevention
- Unreachable via public API; avoid reflective/mocked construction of Collector and use Collector.newBuilder(Class).
When it happens
Trigger: Constructing Collector via a Builder obtained only through Collector.newBuilder(...) after nulling the logger reflectively, or a new entry point that skips logger initialization. Not reachable from normal public API use.
Common situations: Reflection/mocking frameworks (e.g. Mockito constructing with null fields); modified or forked builder code that loses the logger assignment.
Related errors
AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14).
Data as JSON: /api/errors/0e05e7eccb647a35.
Report an issue: GitHub.