{"record":{"id":"4bbe7d535a7be28a","repo":"apache/seatunnel","slug":"create-activemq-client-failed","errorCode":"CREATE_ACTIVEMQ_CLIENT_FAILED","errorMessage":"Error while create AMQ client ","messagePattern":"Error while create AMQ client ","errorType":"error_code","errorClass":"ActivemqConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-activemq/src/main/java/org/apache/seatunnel/connectors/seatunnel/activemq/client/ActivemqClient.java","lineNumber":67,"sourceCode":"import static org.apache.seatunnel.connectors.seatunnel.activemq.config.ActivemqSinkOptions.WARN_ABOUT_UNSTARTED_CONNECTION_TIMEOUT;\n\n@Slf4j\npublic class ActivemqClient {\n    private final ReadonlyConfig config;\n    private final ActiveMQConnectionFactory connectionFactory;\n    private final Connection connection;\n\n    public ActivemqClient(ReadonlyConfig config) {\n        this.config = config;\n        try {\n            this.connectionFactory = getConnectionFactory();\n            log.info(\"connection factory created\");\n            this.connection = createConnection(config);\n            log.info(\"connection created\");\n\n        } catch (Exception e) {\n            log.error(\"Error while creating AMQ client\", e);\n            throw new ActivemqConnectorException(\n                    ActivemqConnectorErrorCode.CREATE_ACTIVEMQ_CLIENT_FAILED,\n                    \"Error while create AMQ client \",\n                    e);\n        }\n    }\n\n    public ActiveMQConnectionFactory getConnectionFactory() {\n        log.info(\"broker url : \" + config.get(URI));\n        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.get(URI));\n\n        if (config.get(ALWAYS_SESSION_ASYNC) != null) {\n            factory.setAlwaysSessionAsync(config.get(ALWAYS_SESSION_ASYNC));\n        }\n\n        if (config.get(CLIENT_ID) != null) {\n            factory.setClientID(config.get(CLIENT_ID));\n        }\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-activemq/src/main/java/org/apache/seatunnel/connectors/seatunnel/activemq/client/ActivemqClient.java#L49-L85","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the broker URL, host and port in the connector config and confirm the ActiveMQ broker is reachable (telnet/nc the port)","Check credentials in the config for correctness","Inspect the wrapped cause 'e' in the stack trace for the underlying JMSException reason","Ensure the ActiveMQ client dependency/jar is present in the plugin directory (install-plugin.sh)"],"exampleFix":"// before\nurl = \"tcp://localhost:6166\"  // wrong port\n// after\nurl = \"tcp://localhost:61616\" // correct ActiveMQ default port","handlingStrategy":"try-catch","validationCode":"// before constructing client\ntry (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 3000); } // broker reachable?","typeGuard":null,"tryCatchPattern":"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 */ } }","preventionTips":["Verify broker URL/port/credentials in the connector config before submission","Smoke-test connectivity (telnet host 61616) from the same network the job runs in","Keep ActiveMQ client jars installed in the plugin directory","Monitor broker uptime and use failover transport URLs (failover:tcp://host:61616)"],"tags":["activemq","jms","connection","network"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}