Search code examples
apache-kafkarabbitmqapache-kafka-connect

Issues with RabbitMQ Source Connector Configuration - java.io.IOException Errors with SSL


I'm facing an issue with my RabbitMQ Source Connector configuration. When I try to set up the connector, I receive a 400 Bad Request error with multiple java.io.IOException errors during connection creation. Here are the details:

================================

Configuration: Plain Text

{
    "name": "rabbitmq-source-connector-test",
    "config": {
        "connector.class": "io.confluent.connect.rabbitmq.RabbitMQSourceConnector",
        "tasks.max": "1",
        "kafka.topic": "Rabbitmq.Event.Push.test",
        "rabbitmq.host": "xxxxx.myhost.net",
        "rabbitmq.port": "5671",
        "rabbitmq.username": "****",
        "rabbitmq.password": "****",
        "confluent.topic.bootstrap.servers": "xxxxxxxx.xxxxxxxxx.us-central1.gcp.confluent.cloud:9092",
        "confluent.topic.sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"****\" password=\"****\";",
        "confluent.topic.security.protocol": "SASL_SSL",
        "confluent.topic.sasl.mechanism": "PLAIN",
        "rabbitmq.security.protocol": "SSL",
        "rabbitmq.https.ssl.truststore.location": "/tmp/truststore.jks",
        "rabbitmq.https.ssl.truststore.password": "****",
        "rabbitmq.https.ssl.keystore.location": "/tmp/keystore.jks",
        "rabbitmq.https.ssl.keystore.password": "****",
        "rabbitmq.queue": "santosh.test"
    }
}

Error Message with CURL post command:

Plain Text HTTP/1.1 400 Bad Request content-length: 562 content-type: application/json date: Thu, 05 Dec 2024 00:52:37 GMT x-ratelimit-limit: 0 x-ratelimit-remaining: 0 x-ratelimit-reset: 0 via: 1.1 google {"error_code":400,"message":"Connector configuration is invalid and contains the following 5 error(s):\nError java.io.IOException occurred during connection creation: null\nError java.io.IOException occurred during connection creation: null\nError java.io.IOException occurred during connection creation: null\nError java.io.IOException occurred during connection creation: null\nError java.io.IOException occurred during connection creation: null\nYou can also find the above list of errors at the endpoint /connector-plugins/{connectorType}/config/validate"}

Additional Information:

  • This connector is running on Kubernetes.
  • The RabbitMQ plugin version is 1.7.4.
  • I have also validated that port 5671 is open.

Steps Taken:

Verified SSL configuration (truststore and keystore paths and passwords). Checked network and firewall settings. Validated configuration using the /connector-plugins/{connectorType}/config/validate endpoint. Reviewed RabbitMQ and Kafka logs for additional context. Despite these steps, the issue persists. Any insights or suggestions on how to resolve this would be greatly appreciated! Thank you!

Refrence links: https://docs.confluent.io/kafka-connectors/rabbitmq-source/current/config.html#rabbit-m-q-source-connector-config

Error logs of Connector pod:

Wed, Dec 4 2024 4:47:07 pm[2024-12-05 00:47:07,639] ERROR An unexpected connection driver error occured (com.rabbitmq.client.impl.ForgivingExceptionHandler) Wed, Dec 4 2024 4:47:07 pmjava.net.SocketException: Connection or outbound has been closed Wed, Dec 4 2024 4:47:07 pm at java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:291) Wed, Dec 4 2024 4:47:07 pm at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1308) Wed, Dec 4 2024 4:47:07 pm at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) Wed, Dec 4 2024 4:47:07 pm at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) Wed, Dec 4 2024 4:47:07 pm at java.base/java.io.DataOutputStream.flush(DataOutputStream.java:128) Wed, Dec 4 2024 4:47:07 pm at com.rabbitmq.client.impl.SocketFrameHandler.flush(SocketFrameHandler.java:197) Wed, Dec 4 2024 4:47:07 pm at com.rabbitmq.client.impl.AMQConnection.flush(AMQConnection.java:636) Wed, Dec 4 2024 4:47:07 pm at com.rabbitmq.client.impl.AMQCommand.transmit(AMQCommand.java:134) Wed, Dec 4 2024 4:47:07 pm at com.rabbitmq.client.impl.AMQChannel.quiescingTransmit(AMQChannel.java:455) Wed, Dec 4 2024 4:47:07 pm at com.rabbitmq.client.impl.AMQChannel.quiescingTransmit(AMQChannel.java:434) Wed, Dec 4 2024 4:47:07 pm at


Solution

  • It started working when I explicitly added rabbitmq.virtual.host in my JSON.

    "rabbitmq.virtual.host": "myhost",
    

    Previously, I hadn’t included this field as it’s not mandatory and defaults to '/'. However, I realized that my RabbitMQ server doesn’t have the default host '/'. So, I explicitly specified the virtual host present on my RabbitMQ server. After making this change and posting the CURL request, I received a 201 response.

    Since I’m not a RabbitMQ admin, I’m not sure if not having the default host '/ ' is considered standard or not.

    Interestingly, the error response from the CURL post didn’t clearly indicate the exact issue, which made this a bit tricky to debug.