apache/seatunnel · error · ActivemqConnectorException

CREATE_ACTIVEMQ_CLIENT_FAILED

CREATE_ACTIVEMQ_CLIENT_FAILED

Error message

Error while create AMQ client 

What it means

The ActivemqClient constructor creates a JMS ConnectionFactory and a JMS Connection from the given config; any Exception during this initialization is wrapped into an ActivemqConnectorException with code CREATE_ACTIVEMQ_CLIENT_FAILED. It means the AMQ client could not be built — typically because the broker was unreachable, credentials were wrong, or the factory could not be instantiated.

Source

Thrown at seatunnel-connectors-v2/connector-activemq/src/main/java/org/apache/seatunnel/connectors/seatunnel/activemq/client/ActivemqClient.java:67

import static org.apache.seatunnel.connectors.seatunnel.activemq.config.ActivemqSinkOptions.WARN_ABOUT_UNSTARTED_CONNECTION_TIMEOUT;

@Slf4j
public class ActivemqClient {
    private final ReadonlyConfig config;
    private final ActiveMQConnectionFactory connectionFactory;
    private final Connection connection;

    public ActivemqClient(ReadonlyConfig config) {
        this.config = config;
        try {
            this.connectionFactory = getConnectionFactory();
            log.info("connection factory created");
            this.connection = createConnection(config);
            log.info("connection created");

        } catch (Exception e) {
            log.error("Error while creating AMQ client", e);
            throw new ActivemqConnectorException(
                    ActivemqConnectorErrorCode.CREATE_ACTIVEMQ_CLIENT_FAILED,
                    "Error while create AMQ client ",
                    e);
        }
    }

    public ActiveMQConnectionFactory getConnectionFactory() {
        log.info("broker url : " + config.get(URI));
        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.get(URI));

        if (config.get(ALWAYS_SESSION_ASYNC) != null) {
            factory.setAlwaysSessionAsync(config.get(ALWAYS_SESSION_ASYNC));
        }

        if (config.get(CLIENT_ID) != null) {
            factory.setClientID(config.get(CLIENT_ID));
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the broker URL, host and port in the connector config and confirm the ActiveMQ broker is reachable (telnet/nc the port)
  2. Check credentials in the config for correctness
  3. Inspect the wrapped cause 'e' in the stack trace for the underlying JMSException reason
  4. Ensure the ActiveMQ client dependency/jar is present in the plugin directory (install-plugin.sh)

Example fix

// before
url = "tcp://localhost:6166"  // wrong port
// after
url = "tcp://localhost:61616" // correct ActiveMQ default port
Defensive patterns

Strategy: try-catch

Validate before calling

// before constructing client
try (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 3000); } // broker reachable?

Try / catch

try { client = new ActivemqClient(config); } catch (ActivemqConnectorException e) { if (e.getErrorCode() == CREATE_ACTIVEMQ_CLIENT_FAILED) { log.error("AMQ init failed", e.getCause()); /* retry with backoff or fail fast */ } }

Prevention

When it happens

Trigger: Constructing ActivemqClient with a config whose URL/host/port points to an unreachable ActiveMQ broker, bad credentials, or invalid connection settings, causing createConnection(config) or the connection-factory creation to throw.

Common situations: Broker not running or wrong broker URL in sink/source config; firewall/network issues in containers; wrong username/password; missing activemq client jars at runtime.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/4bbe7d535a7be28a. Report an issue: GitHub.