Apache Kafka
ConfigException
Bootstrap Servers
Configuration Error
Troubleshooting

org.apache.kafka.common.config.ConfigException Missing required configuration bootstrap.servers which has no default value

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Apache Kafka is a robust, scalable, and effective distributed event streaming platform capable of handling trillions of events a day. While Kafka's capabilities in real-time data processing and high-throughput activities make it indispensable for many applications, setting it up correctly can be crucial. One common issue that users encounter while configuring Kafka producers or consumers is the org.apache.kafka.common.config.ConfigException. This exception includes various subtypes; one particularly prevalent subtype happens due to missing the bootstrap.servers configuration, which notably does not have a default value in Kafka.

Understanding the bootstrap.servers Configuration

The bootstrap.servers configuration specifies a list of host and port pairs that are used by the Kafka client to initially establish connection to the Kafka cluster. This configuration is critical as it serves as the entry point for the Kafka client to perform all operations such as producing and consuming messages, retrieving metadata, and more. This list doesn’t need to include all the brokers in the Kafka cluster. It just needs enough brokers to initially connect to the cluster, which can subsequently use the returned metadata to discover all brokers.

Why It Is Required

This configuration is necessary because Kafka clients need to know where to connect to start interacting with the cluster. Without this information, the client is simply blind and cannot function.

Example of Configuration Usage

Here's how you might typically specify the bootstrap.servers in a Kafka producer configuration in Java:

java
1Properties props = new Properties();
2props.put("bootstrap.servers", "host1:9092,host2:9092");
3props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
4props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
5
6KafkaProducer<String, String> producer = new KafkaProducer<>(props);

In this example, the Kafka producer is configured with two bootstrap servers. Even if one of these servers is down, the producer can connect to the other and start interacting with the cluster.

Common Misconfigurations and Troubleshooting

  • Omission: Omitting the bootstrap.servers will result in the ConfigException.
  • Typographical Errors: Errors in the hostname or port, such as typographical mistakes or incorrect port assignments.
  • Network Issues: Even if bootstrap.servers is correctly configured, network issues can prevent the Kafka client from connecting to these servers.

Troubleshooting Steps

  1. Check the Configuration: Ensure that the bootstrap.servers is correctly specified without typographical errors.
  2. Validate Network Connectivity: Make sure that the client machine can connect to the specified hosts and ports over the network.
  3. Look for Server Logs: Server-side logs might reveal issues related to client connection attempts.

Summary Table

IssueDescriptionImpactResolution Steps
Missing bootstrap.serversNo list of initial Kafka brokers.Failure to connect to Kafka.Specify correct server addresses in the configuration.
Typographical ErrorsErrors in server address or port.Invalid server connection info.Verify correctness of bootstrap.servers values.
Network IssuesNetwork connectivity problems.Inability to reach servers.Check network connections and firewall settings.

Conclusion

The bootstrap.servers configuration plays a fundamental role in setting up Kafka clients. Proper configuration ensures seamless connectivity and functionality of the Kafka client applications. By adequately managing this aspect alongside regular checks and balances for network and typographical errors, organizations can harness the full potential of Kafka effectively and efficiently.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.