{"record":{"id":"d920a616fd3810b5","repo":"apache/beam","slug":"solaceio-write-could-not-create-producer-producer-object-is","errorCode":null,"errorMessage":"SolaceIO.Write: Could not create producer, producer object is null","messagePattern":"SolaceIO\\.Write: Could not create producer, producer object is null","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/JcsmpSessionService.java","lineNumber":136,"sourceCode":"  }\n\n  private MessageProducer createXMLMessageProducer(SubmissionMode submissionMode)\n      throws JCSMPException, IOException {\n\n    if (jcsmpSession == null) {\n      connectWriteSession(submissionMode);\n    }\n\n    @SuppressWarnings(\"nullness\")\n    Callable<XMLMessageProducer> initProducer =\n        () ->\n            Objects.requireNonNull(jcsmpSession)\n                .getMessageProducer(new PublishResultHandler(publishedResultsQueue));\n\n    XMLMessageProducer producer =\n        retryCallableManager.retryCallable(initProducer, ImmutableSet.of(JCSMPException.class));\n    if (producer == null) {\n      throw new IOException(\"SolaceIO.Write: Could not create producer, producer object is null\");\n    }\n    return new SolaceMessageProducer(producer);\n  }\n\n  private MessageReceiver createFlowReceiver() throws JCSMPException, IOException {\n    Queue queue = checkStateNotNull(queue(), \"SolaceIO.Read: Queue is not set.\");\n\n    ConsumerFlowProperties flowProperties = new ConsumerFlowProperties();\n    flowProperties.setEndpoint(queue);\n    flowProperties.setAckMode(JCSMPProperties.SUPPORTED_MESSAGE_ACK_CLIENT);\n\n    EndpointProperties endpointProperties = new EndpointProperties();\n    endpointProperties.setAccessType(EndpointProperties.ACCESSTYPE_NONEXCLUSIVE);\n    if (jcsmpSession != null) {\n      return new SolaceMessageReceiver(\n          createFlowReceiver(jcsmpSession, flowProperties, endpointProperties));\n    }\n    throw new IOException(","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/JcsmpSessionService.java#L118-L154","documentation":"JcsmpSessionService.createXMLMessageProducer retries the JCSMP session's getMessageProducer call (retrying on JCSMPException), but if the retry manager still returns null the service throws this IOException. A null producer means the session never produced a usable message producer, so writes cannot proceed.","triggerScenarios":"Creating a SolaceIO.Write producer when the JCSMP session is not connected / reconnecting, the retryCallable exhausted its retries on repeated JCSMPException, or the callable swallowed the exception and returned null.","commonSituations":"Wrong broker host/message VPN/credentials causing connection failure; session disconnected between connect and producer creation; network partition to port 55455; retry budget too small for slow broker recovery.","solutions":["Check broker connectivity: verify host, port (55455/55443), message VPN, and client credentials in JcsmpConnectionFactory/SolaceIO config.","Inspect logs for the underlying JCSMPException retries before the null was returned.","Increase the retry attempts/backoff in the retryCallableManager to tolerate broker reconnect windows.","Ensure the session is explicitly connected (jcsmpSession.connect()) before producer creation in custom setups."],"exampleFix":"// before\nJCSMPProperties props = JCSMPProperties.fromProperties(basicProps); // missing VPN\n// after\nprops.setProperty(JCSMPProperties.VPN_NAME, \"my_vpn\");\nprops.setProperty(JCSMPProperties.HOST, \"tcp://broker:55455\");","handlingStrategy":"retry","validationCode":"// Pre-flight session connectivity check\n// JCSMPSession s = JCSMPFactory.onlyInstance().createSession(props); s.connect(); s.close();","typeGuard":null,"tryCatchPattern":"try { pipeline.run(); }\ncatch (IOException e) {\n  if (e.getMessage().contains(\"Could not create producer\")) reconnectAndRetry();\n  else throw e;\n}","preventionTips":["Validate JCSMPProperties (host, VPN, username/password) with a standalone connect test.","Size the producer-creation retry budget/backoff for broker reconnect latency.","Monitor Solace broker health/connections; network drops to port 55455 are the usual culprit."],"tags":["solace","jcsmp","producer","connection"],"backgroundTag":"connection-refused","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}