Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Failed to construct kafka producer, ConfigException: No resolvable bootstrap urls given in bootstrap.servers

New Contributor

I'm using HDP 2.3.4 with kafka 0.9

The kafka console producer/consumer worked well, but when I tried to create a simple kafka producer using scala in windows, it went into exception with error description in subject. Scala code was some sample code from git, as below:

object ProducerExample extends App {  

import java.util.Properties
import org.apache.kafka.clients.producer._

val  props = new Properties() 
props.put("bootstrap.servers", "serverX:6667")   
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer") 
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer")
props.put("security.protocol", "SASL_PLAINTEXT")
val producer = new KafkaProducer[String, String](props)    
val TOPIC="test"  

for(i<- 1 to 50){  
	val record = new ProducerRecord(TOPIC, "key", s"hello $i")  

val record = new ProducerRecord(TOPIC, "key", "the end "+new java.util.Date) 

I'm pretty sure the bootstrap.servers setting is correct, as the console producer/consumer works with the same value.

Any comments/clues? thanks a lot!


New Contributor

Kafka is installed on a linux box, tested console producer/consumer in the same linux box


looks like your host name is not getting resolved. Pl check your host name. Also enable producer logs for more info.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.