openzipkin/zipkin · error · NullPointerException
queue == null
Error message
queue == null
What it means
ActiveMQCollector.Builder.queue(String) throws NullPointerException on null because the queue name must be a concrete string. It is not a format check — empty or blank strings are technically accepted — only null is rejected; the default queue name is "zipkin".
Source
Thrown at zipkin-collector/activemq/src/main/java/zipkin2/collector/activemq/ActiveMQCollector.java:57
return this;
}
@Override public Builder metrics(CollectorMetrics metrics) {
if (metrics == null) throw new NullPointerException("metrics == null");
this.metrics = metrics.forTransport("activemq");
this.delegate.metrics(this.metrics);
return this;
}
public Builder connectionFactory(ActiveMQConnectionFactory connectionFactory) {
if (connectionFactory == null) throw new NullPointerException("connectionFactory == null");
this.connectionFactory = connectionFactory;
return this;
}
/** Queue zipkin spans will be consumed from. Defaults to "zipkin". */
public Builder queue(String queue) {
if (queue == null) throw new NullPointerException("queue == null");
this.queue = queue;
return this;
}
/** Count of concurrent message listeners on the queue. Defaults to 1 */
public Builder concurrency(int concurrency) {
if (concurrency < 1) throw new IllegalArgumentException("concurrency < 1");
this.concurrency = concurrency;
return this;
}
@Override public ActiveMQCollector build() {
if (connectionFactory == null) throw new NullPointerException("connectionFactory == null");
return new ActiveMQCollector(this);
}
}
final String queue;View on GitHub (pinned to 878ce2a1fa)
Solutions
- Only call .queue(...) when you actually have a non-null name, otherwise rely on the default "zipkin".
- Fix the property source so the queue name resolves (check env var / config key spelling).
- Coalesce to the default: .queue(name != null ? name : "zipkin").
Example fix
// before
String q = System.getenv("ACTIVEMQ_QUEUE"); // null when unset
builder.queue(q); // NPE
// after
if (System.getenv("ACTIVEMQ_QUEUE") != null) builder.queue(System.getenv("ACTIVEMQ_QUEUE")); Defensive patterns
Strategy: validation
Validate before calling
java
String q = System.getenv("ACTIVEMQ_QUEUE");
if (q != null) builder.queue(q); // default "zipkin" otherwise Prevention
- Only call optional-name setters when the value is present; rely on documented defaults otherwise.
When it happens
Trigger: Calling .queue(null), most often by forwarding a null configuration property (e.g. ACTIVEMQ_QUEUE not set and the code does .queue(System.getenv("ACTIVEMQ_QUEUE"))).
Common situations: Optional queue-name config treated as mandatory in code; property typo (queue vs destination); tests omitting the queue setting.
Related errors
AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14).
Data as JSON: /api/errors/140d6238b0d4b5cf.
Report an issue: GitHub.