# Kafka connect server never returns 200

**URL:** <https://forum.confluent.io/t/kafka-connect-server-never-returns-200/8969>\
**Category:** Self-Managed Connectors\
**Created:** [31 October 2023 18:07 UTC](https://forum.confluent.io/t/kafka-connect-server-never-returns-200/8969 "2023-10-31T18:07:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lizard](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/lizard/32/3304_2.png) [@lizard](https://forum.confluent.io/u/lizard)\
**Post date:** [31 October 2023 18:07 UTC](https://forum.confluent.io/t/kafka-connect-server-never-returns-200/8969/1 "2023-10-31T18:07:14Z")

</div>

I have a self managed distributed connect cluster running locally on docker. I am following the kafka-connect-101 training  
On container start up I:

1. Install the splunk sink connector from confluent-hub
2. 

```
Start kafka connect

```

3. 

```
Wait on a loop until the connect server returns 200 to make sure everything is good.

```

4. 

```
Create the splunk sink connector instance.

```

**The problem** : The loop never ends because [http://localhost:8083/connectors](http://localhost:8083/connectors) never returns 200 so it doesn’t even get to the point where the connector instance is created

When i check in the cloud cluster where the connect topics are living i can see the internal connect topics for config, offset and status are created. I can also see the client producer and consumer running.

What am i missing?

**Here is the docker-compose file:**  
Please note some of the connector properties are masked for privacy  
version: ‘2’  
services:

connect-1:  
image: confluentinc/cp-kafka-connect:7.5.0  
restart: always  
hostname: connect-1  
container\_name: connect-1  
ports:  
- “8083:8083”  
volumes:  
- ./data:/data  
environment:  
CONNECT\_BOOTSTRAP\_SERVERS: $BOOTSTRAP\_SERVERS  
#identifies the worker this container will run on. Same Id means running in the same worker  
CONNECT\_GROUP\_ID: “lil\_kc101-connect”  
CONNECT\_CONFIG\_STORAGE\_TOPIC: “lil\_kc101-connect-configs”  
CONNECT\_OFFSET\_STORAGE\_TOPIC: “lil\_kc101-connect-offsets”  
CONNECT\_STATUS\_STORAGE\_TOPIC: “lil\_kc101-connect-status”  
CONNECT\_REPLICATION\_FACTOR: 3  
CONNECT\_CONFIG\_STORAGE\_REPLICATION\_FACTOR: 3  
CONNECT\_OFFSET\_STORAGE\_REPLICATION\_FACTOR: 3  
CONNECT\_STATUS\_STORAGE\_REPLICATION\_FACTOR: 3  
CONNECT\_KEY\_CONVERTER: “org.apache.kafka.connect.storage.StringConverter”

```
  # Confluent Schema Registry for Kafka Connect
  CONNECT_VALUE_CONVERTER: "io.confluent.connect.avro.AvroConverter"
  CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE: "true"
  CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: $SCHEMA_REGISTRY_URL
  CONNECT_VALUE_CONVERTER_BASIC_AUTH_CREDENTIALS_SOURCE: $BASIC_AUTH_CREDENTIALS_SOURCE
  CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_BASIC_AUTH_USER_INFO: $SCHEMA_REGISTRY_BASIC_AUTH_USER_INFO

  CONNECT_REST_ADVERTISED_HOST_NAME: "connect-1"
  CONNECT_LISTENERS: http://connect-1:8083
  CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components"
  CONNECT_LOG4J_APPENDER_STDOUT_LAYOUT_CONVERSIONPATTERN: "[%d] %p %X{connector.context}%m (%c:%L)%n"
  CONNECT_LOG4J_ROOT_LOGLEVEL: INFO
  CONNECT_LOG4J_LOGGERS: 'org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR'

  # Confluent Cloud config
  CONNECT_REQUEST_TIMEOUT_MS: "20000"
  CONNECT_RETRY_BACKOFF_MS: "500"
  CONNECT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM: "https"

  # Connect worker
  CONNECT_SECURITY_PROTOCOL: SASL_SSL
  CONNECT_SASL_JAAS_CONFIG: $SASL_JAAS_CONFIG
  CONNECT_SASL_MECHANISM: PLAIN

  # Connect producer
  CONNECT_PRODUCER_SECURITY_PROTOCOL: SASL_SSL
  CONNECT_PRODUCER_SASL_JAAS_CONFIG: $SASL_JAAS_CONFIG
  CONNECT_PRODUCER_SASL_MECHANISM: PLAIN

  # Connect consumer
  CONNECT_CONSUMER_SECURITY_PROTOCOL: SASL_SSL
  CONNECT_CONSUMER_SASL_JAAS_CONFIG: $SASL_JAAS_CONFIG
  CONNECT_CONSUMER_SASL_MECHANISM: PLAIN

command:
  - bash
  - -c
  - |
    #Install confluent splunk sing connector
    confluent-hub install --no-prompt splunk/kafka-connect-splunk:2.1.1
    
    echo "---- LAUNCHING KAFKA-CONNECT -----"
    /etc/confluent/docker/run &
    
    echo "---- WAITING FOR KAFKA-CONNECT TO START LISTENING ON http://localhost:8083 ------ "
    while [$$(curl -s -o /dev/null -w %{http_code} http://localhost:8083/connectors) -ne 200] ; do
      echo -e $$(date) " Kafka Connect listener HTTP state: " $$(curl -s -o /dev/null -w %{http_code} http://localhost:8083/connectors) " (waiting for 200)"
    sleep 5
    done

    echo "----------------- Creating Splunk sink connector-------------"
                   
    curl -s -X PUT -H "Content-Type:application/json" http://localhost:8083/connectors/splunk-sink-1/config \
    -d '{
      "name": "splunk-sink_1",
      "config": {
        "connector.class"="com.splunk.kafka.connect.SplunkSinkConnector",
        "splunk.hec.token"=" ************************************",
        "splunk.hec.uri"=" ****************************************",
        "splunk.header.index"=" ************************************",
        "tasks.max": 3,
        "topics": "confluent-audit-log-events",
        "key.converter": "org.apache.kafka.connect.storage.StringConverter",
        "max.interval":750
      }
    }'

    sleep infinity

```

**Here is what the container log is showing:**

2023-10-31 12:02:44 Running in a “–no-prompt” mode  
2023-10-31 12:02:46 javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target  
2023-10-31 12:02:46  
2023-10-31 12:02:46 Error: Unknown error  
2023-10-31 12:02:46 ---- LAUNCHING KAFKA-CONNECT -----  
2023-10-31 12:02:46 ---- WAITING FOR KAFKA-CONNECT TO START LISTENING ON [http://localhost:8083](http://localhost:8083) ------  
2023-10-31 12:02:46 ===\> User  
2023-10-31 12:02:46 uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)  
2023-10-31 12:02:46 ===\> Configuring …  
… _a lot of info on connect start up then at the end_…  
2023-10-31 12:04:00 [2023-10-31 16:04:00,139] INFO [Worker clientId=connect-1, groupId=lil\_kc101-connect] Session key updated (org.apache.kafka.connect.runtime.distributed.DistributedHerder:2255)  
2023-10-31 12:04:02 Tue Oct 31 16:04:02 UTC 2023 Kafka Connect listener HTTP state: 000 (waiting for 200)  
2023-10-31 12:04:07 Tue Oct 31 16:04:07 UTC 2023 Kafka Connect listener HTTP state: 000 (waiting for 200)  
2023-10-31 12:04:12 Tue Oct 31 16:04:12 UTC 2023 Kafka Connect listener HTTP state: 000 (waiting for 200)  
2023-10-31 12:04:17 Tue Oct 31 16:04:17 UTC 2023 Kafka Connect listener HTTP state: 000 (waiting for 200)  
2023-10-31 12:04:22 Tue Oct 31 16:04:22 UTC 2023 Kafka Connect listener HTTP state: 000 (waiting for 200)  
**and the loop never ends**

---

<div class="post-metadata">

**Author:** ![lizard](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/lizard/32/3304_2.png) [@lizard](https://forum.confluent.io/u/lizard)\
**Post date:** [1 November 2023 17:35 UTC](https://forum.confluent.io/t/kafka-connect-server-never-returns-200/8969/2 "2023-11-01T17:35:32Z")

</div>

The cause of this problem was using the wrong host name in the loop waiting for the server to start  
$CONNECT\_REST\_ADVERTISED\_HOST\_NAME is “ **connect-1** ”  
so that is the host name that should be used instead of localhost:  
while [$$(curl -s -o /dev/null -w %{http\_code} **[http://connect-1:8083/connectors](http://connect-1:8083/connectors)**) -ne 200 ] ; do  
echo -e $$(date) " Kafka Connect listener HTTP state: " $$(curl -s -o /dev/null -w %{http\_code} **[http://connect-1:8083/connectors](http://connect-1:8083/connectors))**" (waiting for 200)"  
sleep 5  
done

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [7 November 2023 05:01 UTC](https://forum.confluent.io/t/kafka-connect-server-never-returns-200/8969/3 "2023-11-07T05:01:24Z")

</div>

Using localhost is correct since it’s just running the command within the container…

Changing `CONNECT_LISTENERS` to bind to the default 0.0.0.0 address would have been the more appropriate solution.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [14 November 2023 05:01 UTC](https://forum.confluent.io/t/kafka-connect-server-never-returns-200/8969/4 "2023-11-14T05:01:47Z")

</div>

Closed on 14 November 2023 05:01 UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
