apache/seatunnel · error · RabbitmqConnectorException
RABBITMQ-08
RABBITMQ-08
Error message
initialize ssl context failed
What it means
When RabbitmqClient.createConnectionFactory sets a uri starting with amqps://, the underlying ConnectionFactory.setUri initializes SSL context material; a KeyManagementException there is wrapped in RabbitmqConnectorException with INIT_SSL_CONTEXT_FAILED ('initialize ssl context failed'). The code comment notes this 'should never happen' — it only occurs when the JVM's SSL/TLS environment is broken, e.g. no valid TLS algorithm or keystore issues.
Source
Thrown at seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java:111
* @param queue blocking queue
* @param splitId split id
* @return consumer instance
*/
public DefaultConsumer getQueueingConsumer(
BlockingQueue<DeliveryMessage> queue, String splitId) {
return new QueueingConsumer(channel, queue, splitId);
}
private ConnectionFactory createConnectionFactory() {
ConnectionFactory factory = new ConnectionFactory();
if (StringUtils.isNotEmpty(config.getUri())) {
try {
factory.setUri(config.getUri());
} catch (URISyntaxException e) {
throw new RabbitmqConnectorException(PARSE_URI_FAILED, e);
} catch (KeyManagementException e) {
// this should never happen
throw new RabbitmqConnectorException(INIT_SSL_CONTEXT_FAILED, e);
} catch (NoSuchAlgorithmException e) {
// this should never happen
throw new RabbitmqConnectorException(SETUP_SSL_FACTORY_FAILED, e);
}
} else {
factory.setHost(config.getHost());
factory.setPort(config.getPort());
if (StringUtils.isNotEmpty(config.getVirtualHost())) {
factory.setVirtualHost(config.getVirtualHost());
}
factory.setUsername(config.getUsername());
factory.setPassword(config.getPassword());
}
if (config.getAutomaticRecovery() != null) {
factory.setAutomaticRecoveryEnabled(config.getAutomaticRecovery());
}
if (config.getConnectionTimeout() != null) {View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the wrapped KeyManagementException cause for the exact SSL init problem
- Check JVM security config: java.security, jdk.tls.disabledAlgorithms, and that a valid TLS provider is available
- Verify keystore/truststore paths and passwords passed via -Djavax.net.ssl.* system properties are correct and files readable
- Upgrade to a supported JDK with healthy TLS defaults, or switch to a non-TLS amqp:// uri if TLS is not actually required
- Test TLS from the worker node with a minimal Java snippet or openssl s_client -connect host:5671
Example fix
// before java ... -Djavax.net.ssl.trustStore=/wrong/path/cacerts // after java ... -Djavax.net.ssl.trustStore=/opt/jdk/lib/security/cacerts -Djavax.net.ssl.trustStorePassword=changeit
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: verify TLS can be initialized on the worker JVM
try {
javax.net.ssl.SSLContext.getInstance("TLSv1.2");
javax.net.ssl.SSLContext.getDefault();
} catch (Exception e) {
throw new IllegalStateException("JVM TLS environment broken before RMQ amqps connection", e);
} Try / catch
try {
new RabbitmqClient(config, ...);
} catch (RabbitmqConnectorException e) {
if (e.getErrorCode() == RabbitmqConnectorErrorCode.INIT_SSL_CONTEXT_FAILED) {
LOG.error("SSL context init failed for amqps uri; check JVM TLS config/keystores",
e.getCause());
} else throw e;
} Prevention
- Verify the worker JVM can initialize SSLContext (no over-restrictive jdk.tls.disabledAlgorithms)
- Check keystore/truststore files exist, are readable, and passwords are correct
- Use a supported JDK with healthy TLS defaults
- If TLS is not required, use amqp:// (non-TLS) uri or host/port config instead
When it happens
Trigger: factory.setUri(config.getUri()) with an amqps:// URI throws KeyManagementException inside createConnectionFactory — typically when TLS provider/keystore initialization fails on the worker JVM.
Common situations: Misconfigured JVM security properties (jdk.tls.disabledAlgorithms disabling all TLS versions); corrupted or unreadable keystore/truststore; custom SecurityProvider conflicts; restricted crypto (JCE policy) in old JDKs.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
Related errors
- RABBITMQ-07
- RABBITMQ-09
- Could not load keystore
- Could not load truststore
- Unexpected default trust managers:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/095955bbf80ed39c.
Report an issue: GitHub.