gpt4 book ai didi

java - 想要输入主机名:9092 in BootStrap url(I have the hostname entry against the actual url in my host file windows) JAVA

转载 作者:行者123 更新时间:2023-11-30 05:21:14 27 4
gpt4 key购买 nike

想要输入 subham-virtualbox:9092 而不是 172.16.6.86:9092 作为我的 bootstrapURL 和 schemaRegistryurl。

我的主机文件中有此条目需要解决

172.16.6.86 subham-virtualbox

尝试这样做,但出现错误,

Exception in thread "main" org.apache.kafka.common.errors.SerializationException: Error serializing Avro message
Caused by: java.net.MalformedURLException: unknown protocol: subham-virtualbox
at java.net.URL.<init>(URL.java:617)
at java.net.URL.<init>(URL.java:507)
at java.net.URL.<init>(URL.java:456)
at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:175)
at io.confluent.kafka.schemaregistry.client.rest.RestService.httpRequest(RestService.java:256)
at io.confluent.kafka.schemaregistry.client.rest.RestService.registerSchema(RestService.java:356)
at io.confluent.kafka.schemaregistry.client.rest.RestService.registerSchema(RestService.java:348)
at io.confluent.kafka.schemaregistry.client.rest.RestService.registerSchema(RestService.java:334)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.registerAndGetId(CachedSchemaRegistryClient.java:168)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.register(CachedSchemaRegistryClient.java:222)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.register(CachedSchemaRegistryClient.java:198)
at io.confluent.kafka.serializers.AbstractKafkaAvroSerializer.serializeImpl(AbstractKafkaAvroSerializer.java:70)
at io.confluent.kafka.serializers.KafkaAvroSerializer.serialize(KafkaAvroSerializer.java:53)
at org.apache.kafka.common.serialization.Serializer.serialize(Serializer.java:62)
at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:903)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:865)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:752)
at com.github.meSubhamSaraf.AvroSerializerDemo.main(AvroSerializerDemo.java:58)

最佳答案

错误并不是说 UnknownHostException

schema.registry.url 需要一个协议(protocol),并且它的端口不是 9092

http://subham-virtualbox:8081

您的引导服务器可以是subham-virtualbox:9092

就我个人而言,我建议使用 Docker 并为注册表进行简单的端口转发,而不是整个虚拟机。
否则,Vagrant works great并可以通过插件为您编辑主机文件

关于java - 想要输入主机名:9092 in BootStrap url(I have the hostname entry against the actual url in my host file windows) JAVA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59542259/

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