Kafka Getting error No resolvable bootstrap urls given in bootstrap servers
Asked Answered
G

7

33

I'm pretty sure the bootstrap.servers is correct. Is there anything confliction in Maven or what wrong with Kafka??

Before that It was working successfully. I added some Maven or Spark then something went wrong..

Can anyone knows how to resolve it?

Here is kafka code in java

Properties props = new Properties();
        props.put("bootstrap.servers", "x.xx.xxx.xxx:9092");
        props.put("metadata.broker.list", "x.xx.xxx.xxx:9091, x.xx.xxx.xxx:9092, x.xx.xxx.xxx:9093");

        props.put("producer.type", "async");
        props.put("batch.size", "500");
        props.put("compression.codec", "1");
        props.put("compression.topic", topicName);
        props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
        props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");

            org.apache.kafka.clients.producer.Producer<String, String> producer = new KafkaProducer<String, String>(
                    props);

Getting error No resolvable bootstrap urls given in bootstrap servers,

[err]   at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:335)
    [err]   at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:188)
    [err]   at com.wra.controller.ParserController.GetResumeUpload(ParserController.java:98)
    [err]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [err]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
    [err]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    [err]   at java.lang.reflect.Method.invoke(Method.java:508)
    [err]   at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    [err]   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    [err]   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
    [err]   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    [err]   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    [err]   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    [err]   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    [err]   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    [err]   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    [err]   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    [err]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    [err]   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    [err]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    [err]   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
    [err]   at [internal classes]
    [err]   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    [err]   at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
    [err]   at [internal classes]
    [err]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
    [err]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    [err]   at java.lang.Thread.run(Thread.java:785)
    [err] Caused by: 
    [err] org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers
    [err]   at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:59)
    [err]   at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:275)
    [err]   ... 51 more
Gossipmonger answered 16/11, 2016 at 13:4 Comment(2)
Have you tried to use the IP instead of the server name? Maybe it is a name resolution issueContraindicate
@Vimal Dhaduk, Did you able to resolve this issue?Roshan
C
19

"metadata.broker.list" is deprecated and "bootstrap.servers" is used instead. Removing "metadata.broker.list" configuration from your code should resolve the problem. Please find more details at difference between bootstrap.servers and metadata.broker.list

Chaffee answered 27/3, 2017 at 20:1 Comment(0)
H
7

In my case,the bootstrap.servers were not in the host:port format

Helenahelene answered 9/9, 2021 at 5:3 Comment(2)
Please add further details to expand on your answer, such as working code or documentation citations.Benavides
Thanks for help, i also configured bootstrap.servers as 127.0.0.1 instead of 127.0.0.1:9092. I added port and now it works.Pugilism
N
6

in my case simply company vpn was down and couldn't access servers

Nevile answered 14/2, 2022 at 20:55 Comment(0)
A
3

For anyone encountering this issue with MapR client libraries, you will get this if you forget the / on the front of the stream name.

Amon answered 30/7, 2018 at 2:15 Comment(0)
V
2

This error can indicate a network connectivity issue. For example, it is triggered if the server host is unknown (no IP associated).

Vindictive answered 27/6, 2023 at 14:54 Comment(0)
E
0

I ran kafka broker and myapp with kafka client in different containers and in my case i did not added param network when ran container with my app.

    docker run -it --rm --network example_network my_repo/my_image:my_tag

The network (example_network) has to be specified in the broker container.

Edmon answered 3/4, 2023 at 12:18 Comment(0)
H
0

In my case, in the the application.properties there was a property 'spring.profiles.active' set as 'stage' by default, changing that to 'local' resolved the error for me

spring.profiles.active = stage -> local
Handball answered 11/9, 2023 at 9:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.