{"record":{"id":"eb170fef68ae9ff4","repo":"openzipkin/zipkin","slug":"connectionfactory-null-eb170f","errorCode":null,"errorMessage":"connectionFactory == null","messagePattern":"connectionFactory == null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-collector/rabbitmq/src/main/java/zipkin2/collector/rabbitmq/RabbitMQCollector.java","lineNumber":83,"sourceCode":"    public Builder metrics(CollectorMetrics metrics) {\n      if (metrics == null) throw new NullPointerException(\"metrics == null\");\n      this.metrics = metrics.forTransport(\"rabbitmq\");\n      this.delegate.metrics(this.metrics);\n      return this;\n    }\n\n    public Builder addresses(List<String> addresses) {\n      this.addresses = convertAddresses(addresses);\n      return this;\n    }\n\n    public Builder concurrency(int concurrency) {\n      this.concurrency = concurrency;\n      return this;\n    }\n\n    public Builder connectionFactory(ConnectionFactory 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-spans\". */\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    @Override\n    public RabbitMQCollector build() {\n      return new RabbitMQCollector(this);\n    }\n  }\n\n  final String queue;","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-collector/rabbitmq/src/main/java/zipkin2/collector/rabbitmq/RabbitMQCollector.java#L65-L101","documentation":"RabbitMQCollector.Builder.connectionFactory(ConnectionFactory) throws NullPointerException when null. The ConnectionFactory is how the collector creates its AMQP connection(s); supplying one lets you customize credentials/vhosts, and the builder demands it be a real instance. If you never call it, a default factory is used at connect time.","triggerScenarios":"Calling .connectionFactory(null) — e.g. a factory bean that failed to initialize and returned null, or a config branch intended to 'use the default' passing null explicitly.","commonSituations":"Conditional wiring where 'use default factory' is expressed as null instead of omitting the setter call; or a custom factory built from config keys that were missing.","solutions":["To use defaults, simply do not call connectionFactory() at all","Otherwise pass a configured com.rabbitmq.client.ConnectionFactory (host, credentials, vhost, TLS)","Fix the factory bean/config so it never yields null"],"exampleFix":"// before\nConnectionFactory cf = config.hasRabbitConfig() ? buildFactory(config) : null;\nbuilder.connectionFactory(cf);\n\n// after\nif (config.hasRabbitConfig()) builder.connectionFactory(buildFactory(config));\n// else: omit the call to use the default factory","handlingStrategy":"validation","validationCode":"if (customFactory != null) builder.connectionFactory(customFactory);\n// else: omit the call to use the default factory","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Express 'use default' by omitting the setter, not by passing null","Build the ConnectionFactory eagerly from config so failures surface at wiring time"],"tags":["rabbitmq","zipkin","builder","null-check","amqp"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}