相关疑难解决方法(0)

提供了 kafka schema.registry.url 但不是已知的配置

尝试使用架构注册表发布有关主题的 json 消息,但出现以下错误。以下Spring Boot方法
..

已提供配置“schema.registry.url”,但不是已知配置

应用程序 yml 文件

server:
  port: 9080
spring:
  kafka:
    properties:
      bootstrap.servers: server1:8080 
      schema.registry.url: https://bctdsdg:8081/
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer 
      value-serializer: JsonSerializer.class        
    ssl:
      keystore-location: classpath:cert.jks
      keystore-password: pwd
      key-password: pwd
      truststore-location: classpath:dev_cacerts.jks
      truststore-password: pwd
Run Code Online (Sandbox Code Playgroud)

卡夫卡配置

@Configuration
@EnableKafka
public class KafkaConfig {
    
    @Autowired
    private KafkaProperties kafkaProperties;
    
    @Bean
      public Map<String, Object> producerConfigs() {
        Map<String, Object> props = new HashMap<>();
        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapServers());
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, com.schemaregjson.serdes.JsonSerializer.class);
        props.put("schema.registry.url", "https://bctdsdg:8081/");
        props.putAll(kafkaProperties.getSsl().buildProperties());
        props.putAll(kafkaProperties.getProperties());
        return props;
      }
    
     @Bean
        public ProducerFactory<String, User> producerFactory() {
            return new DefaultKafkaProducerFactory<>(producerConfigs()); …
Run Code Online (Sandbox Code Playgroud)

java apache-kafka confluent-schema-registry

8
推荐指数
1
解决办法
1万
查看次数