Nadina Florea created KAFKA-18543:
-------------------------------------

             Summary: Strict validation of bootstrap.servers in Kafka Clients 
3.8.x causing issues with multiline configurations
                 Key: KAFKA-18543
                 URL: https://issues.apache.org/jira/browse/KAFKA-18543
             Project: Kafka
          Issue Type: Bug
          Components: clients
    Affects Versions: 3.8.1
            Reporter: Nadina Florea


Hello,

We encountered an issue when upgrading to *Kafka Clients 3.8.x* (from 3.7.2). 
The problem occurs when the bootstrap.servers configuration is defined in YAML 
files using multiline syntax (e.g., using >, or as a list of brokers). 
Previously, with Kafka Clients 3.7.x, this configuration worked fine even with 
newlines in the brokers’ addresses, but in Kafka Clients 3.8.x, the validation 
was made stricter, resulting in the following error:
{code:java}
org.apache.kafka.common.config.ConfigException: Invalid url in bootstrap.servers
{code}
Environment:

• Kafka Clients Version: 3.8.1
• Apache Camel Version: 4.9.0
• Spring Boot Version: 3.4.1
• Java Version: 17

We are using Apache Camel to connect to Kafka, and Camel simply passes the 
Spring Boot auto-configured values (including bootstrap.servers) to Kafka. 
Camel doesn’t modify the configuration itself.

Steps to Reproduce:
1. Define bootstrap.servers in application.yaml using multiline syntax:
{code:java}
camel:
 component:
   kafka:
     brokers: >-
       broker1:9092,
       broker2:9092{code}
2. Use the following setup in logback-spring.xml to configure Kafka Appender:
{code:java}
<springProperty name="brokers" source="camel.component.kafka.brokers" />
<appender name="KAFKA" class="ch.qos.logback.classic.net.KafkaAppender">
<kafkaProp>
       bootstrap.servers=${brokers}
</kafkaProp>
</appender>{code}
3. Run the application.

The application fails to start with the following error:

_*org.apache.camel.RuntimeCamelException: 
org.apache.kafka.common.config.ConfigException: Invalid url in 
bootstrap.servers:  broker2:9092*_

 

• The error occurs due to the stricter validation introduced in  KAFKA-17584., 
which does not allow newline characters or improperly formatted values for 
bootstrap.servers.
• Previously, Kafka Clients 3.7.x seemed to accept multiline configurations 
more leniently.

*Is this stricter validation behavior intentional in Kafka Clients 3.8.x, and 
is it a permanent change?*
We would like to understand whether this behavior is expected or if it could be 
reconsidered in future Kafka versions to support multiline configurations, as 
this change has introduced compatibility issues with Camel applications.

For users using Camel with Spring Boot, this issue is particularly problematic 
since the brokers’ list often appears on multiple lines in YAML files for 
better readability. This could make configuration difficult to manage if forced 
onto a single line.
It would be helpful if Kafka allowed multiline configuration for 
bootstrap.servers to avoid forcing users to put all brokers on a single line.

 

• Similar issue already reported: KAFKA-18171

• When I updated my YAML configuration to write *bootstrap.servers on a single 
line* (e.g., broker1:9092,broker2:9092), the issue was resolved.
• _Applications that use Spring Kafka directly without Camel are not affected 
by this issue._

Thank you!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to