gpt4 book ai didi

java - 卡夫卡收到错误 Bootstrap 服务器中没有给出可解析的 Bootstrap 网址

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:55:29 24 4
gpt4 key购买 nike

我很确定 bootstrap.servers 是正确的。是不是Maven有什么冲突或者Kafka有什么问题??

在此之前它运行成功。我添加了一些 Maven 或 Spark 然后出了点问题..

谁知道怎么解决?

这是java中的kafka代码

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);

获取错误 Bootstrap 服务器中没有给出可解析的 Bootstrap url,

[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

最佳答案

“metadata.broker.list”已弃用,取而代之的是“bootstrap.servers”。从代码中删除“metadata.broker.list”配置应该可以解决问题。请在 difference between bootstrap.servers and metadata.broker.list 找到更多详细信息

关于java - 卡夫卡收到错误 Bootstrap 服务器中没有给出可解析的 Bootstrap 网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40632900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com