{"record":{"id":"fae09e1ac964becf","repo":"openzipkin/zipkin","slug":"connectionfactory-null","errorCode":null,"errorMessage":"connectionFactory == null","messagePattern":"connectionFactory == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-collector/activemq/src/main/java/zipkin2/collector/activemq/ActiveMQCollector.java","lineNumber":50,"sourceCode":"    @Override public Builder storage(StorageComponent storage) {\n      this.delegate.storage(storage);\n      return this;\n    }\n\n    @Override public Builder sampler(CollectorSampler sampler) {\n      this.delegate.sampler(sampler);\n      return this;\n    }\n\n    @Override public Builder metrics(CollectorMetrics metrics) {\n      if (metrics == null) throw new NullPointerException(\"metrics == null\");\n      this.metrics = metrics.forTransport(\"activemq\");\n      this.delegate.metrics(this.metrics);\n      return this;\n    }\n\n    public Builder connectionFactory(ActiveMQConnectionFactory connectionFactory) {\n      if (connectionFactory == null) throw new NullPointerException(\"connectionFactory == null\");\n      this.connectionFactory = connectionFactory;\n      return this;\n    }\n\n    /** Queue zipkin spans will be consumed from. Defaults to \"zipkin\". */\n    public Builder queue(String queue) {\n      if (queue == null) throw new NullPointerException(\"queue == null\");\n      this.queue = queue;\n      return this;\n    }\n\n    /** Count of concurrent message listeners on the queue. Defaults to 1 */\n    public Builder concurrency(int concurrency) {\n      if (concurrency < 1) throw new IllegalArgumentException(\"concurrency < 1\");\n      this.concurrency = concurrency;\n      return this;\n    }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/activemq/src/main/java/zipkin2/collector/activemq/ActiveMQCollector.java#L32-L68","documentation":"ActiveMQCollector.Builder.connectionFactory rejects null because the collector needs a configured ActiveMQConnectionFactory to create connections and message listeners on the zipkin queue. Unlike metrics/storage, there is no default: an ActiveMQ broker connection is mandatory for this collector type.","triggerScenarios":"Calling .connectionFactory(null) on the ActiveMQ collector builder — usually an unset broker URL property being passed straight through.","commonSituations":"Missing ACTIVEMQ_URL/broker configuration in env-driven setup; unit tests building the collector without a broker; refactoring that dropped the factory creation line.","solutions":["Create and set the factory from the broker URL: new ActiveMQConnectionFactory(\"tcp://broker:61616\") then pass it.","Verify the broker URL configuration property is present before building the collector.","In tests, use an embedded broker (e.g. vm://localhost) instead of passing null."],"exampleFix":"// before\nActiveMQCollector.newBuilder(SERVER).connectionFactory(null); // NPE\n\n// after\nActiveMQCollector.newBuilder(SERVER)\n    .connectionFactory(new ActiveMQConnectionFactory(\"tcp://localhost:61616\"));","handlingStrategy":"validation","validationCode":"java\nObjects.requireNonNull(brokerUrl, \"broker URL must be configured\");\nbuilder.connectionFactory(new ActiveMQConnectionFactory(brokerUrl));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate required config (broker URL) at startup with a clear message before touching builders.","Fail fast on missing env vars instead of forwarding nulls."],"tags":["zipkin","java","activemq","jms","configuration"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}