apache/beam · critical · IOException
SolaceIO.Read: Could not create a receiver from the Jcsmp…
Error message
SolaceIO.Read: Could not create a receiver from the Jcsmp session: session object is null.
What it means
SolaceIO.Read throws this IOException in JcsmpSessionService.createFlowReceiver when the JCSMP session object is null at the moment the reader tries to create a message flow receiver. It means the source could not establish a usable session to the Solace broker before subscribing, so reading cannot proceed. This is a fail-fast guard rather than a transient failure: the code checks `if (jcsmpSession != null)` and throws otherwise.
Solutions
- Verify the broker connection parameters (host, VPN, username, password) are correct so the JCSMP session is actually created and connected before reading.
- If using a custom SessionServiceFactory, ensure it returns a service whose `getJcsmpSession()` never returns null and that `session.connect()` was called.
- Check pipeline logs for an earlier JCSMPException during session creation — fix that root cause (DNS, VPN name, auth) first.
- Do not close or null out the session before the read pipeline finishes; guard lifecycle ordering in custom code.
Example fix
// before (custom factory)
public JcsmpSessionService create() {
JCSMPProperties props = new JCSMPProperties();
props.setProperty(JCSMPProperties.HOST, host);
return new JcsmpSessionService(props); // session never connected
}
// after
public JcsmpSessionService create() {
JCSMPProperties props = new JCSMPProperties();
props.setProperty(JCSMPProperties.HOST, host);
props.setProperty(JCSMPProperties.VPN_NAME, vpn);
JCSMPException cause = null;
JCSMPSession session = JCSMPFactory.onlyInstance().createSession(props);
session.connect(); // ensure session is usable
return new JcsmpSessionService(props);
} Defensive patterns
Strategy: validation
Validate before calling
if (sessionService == null || sessionService.getJcsmpSession() == null) {
throw new IllegalArgumentException("JCSMP session not initialized — check broker config/factory");
} Try / catch
try { pipeline.run().waitUntilFinish(); } catch (IOException e) { if (e.getMessage().contains("session object is null")) { /* fix session init, resubmit */ } throw e; } Prevention
- Always verify session.connect() succeeds before starting the read pipeline
- Never return partially initialized services from custom SessionServiceFactory implementations
- Check pipeline logs for earlier JCSMPExceptions that null out the session
When it happens
Trigger: Calling SolaceIO.read() when the JcsmpSessionService was never initialized with a connected session — e.g. `createSession` failed earlier and null was propagated, a custom SessionServiceFactory returned a service whose session is null, or the session was closed/nulled before the pipeline started pulling from the queue.
Common situations: Wrong broker host/credentials causing session creation to silently produce null in a custom factory; a user-supplied `SessionServiceFactory` implementation returning a partially constructed service; session closed by another thread during pipeline teardown or restart; copy-pasted custom broker integration code that doesn't call `session.connect()`.
Related errors
- AUTO is applicable only to reading files
- AUTO is not supported for writing
- Caller does not own the underlying input stream and should…
- Caller does not own the underlying output stream and…
- Can not get unique key from solr
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/c83e6f9feef37364.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/JcsmpSessionService.java:154
throw new IOException("SolaceIO.Write: Could not create producer, producer object is null");
}
return new SolaceMessageProducer(producer);
}
private MessageReceiver createFlowReceiver() throws JCSMPException, IOException {
Queue queue = checkStateNotNull(queue(), "SolaceIO.Read: Queue is not set.");
ConsumerFlowProperties flowProperties = new ConsumerFlowProperties();
flowProperties.setEndpoint(queue);
flowProperties.setAckMode(JCSMPProperties.SUPPORTED_MESSAGE_ACK_CLIENT);
EndpointProperties endpointProperties = new EndpointProperties();
endpointProperties.setAccessType(EndpointProperties.ACCESSTYPE_NONEXCLUSIVE);
if (jcsmpSession != null) {
return new SolaceMessageReceiver(
createFlowReceiver(jcsmpSession, flowProperties, endpointProperties));
}
throw new IOException(
"SolaceIO.Read: Could not create a receiver from the Jcsmp session: session object is"
+ " null.");
}
// The `@SuppressWarning` is needed here, because the checkerframework reports an error for the
// first argument of the `createFlow` being null, even though the documentation allows it:
// https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/JCSMPSession.html#createFlow-com.solacesystems.jcsmp.XMLMessageListener-com.solacesystems.jcsmp.ConsumerFlowProperties-com.solacesystems.jcsmp.EndpointProperties-
@SuppressWarnings("nullness")
private static FlowReceiver createFlowReceiver(
JCSMPSession jcsmpSession,
ConsumerFlowProperties flowProperties,
EndpointProperties endpointProperties)
throws JCSMPException {
return jcsmpSession.createFlow(null, flowProperties, endpointProperties);
}
private int connectReadSession() throws JCSMPException {
if (jcsmpSession == null) {View on GitHub (pinned to 12126d8942)