Java.lang.RuntimeException: ненулевое поле authBytes было сериализовано как пустое из Spring Boot в Azure Event Hub.

Я разрабатываю простое приложение Spring Boot с использованием версии 2.7.5 и пытаюсь отправлять сообщения в концентратор событий. Может ли кто-нибудь помочь мне?

Ошибка:

java.lang.RuntimeException: non-nullable field authBytes was serialized as null
    at org.apache.kafka.common.message.SaslAuthenticateResponseData.read(SaslAuthenticateResponseData.java:137) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.message.SaslAuthenticateResponseData.<init>(SaslAuthenticateResponseData.java:86) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.requests.SaslAuthenticateResponse.parse(SaslAuthenticateResponse.java:76) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.requests.AbstractResponse.parseResponse(AbstractResponse.java:187) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.requests.AbstractResponse.parseResponse(AbstractResponse.java:109) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.NetworkClient.parseResponse(NetworkClient.java:729) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.receiveKafkaResponse(SaslClientAuthenticator.java:576) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.receiveToken(SaslClientAuthenticator.java:508) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.authenticate(SaslClientAuthenticator.java:302) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.network.KafkaChannel.prepare(KafkaChannel.java:181) ~[kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:543) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.common.network.Selector.poll(Selector.java:481) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:560) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.NetworkClientUtils.awaitReady(NetworkClientUtils.java:73) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.awaitNodeReady(Sender.java:526) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.maybeSendAndPollTransactionalRequest(Sender.java:447) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:316) [kafka-clients-3.1.2.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:243) [kafka-clients-3.1.2.jar:na]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_202]

приложение.свойства

server:
  port: 8088
spring:
  kafka:
    client-id: first-producer
    properties:
      sasl.jaas.config: org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="SOME VALUE";
      sasl.mechanism: PLAIN
      security.protocol: SASL_SSL
    consumer:
      bootstrap-servers: AAA.servicebus.windows.net:9093
      group-id: group-id
      auto-offset-reset: earliest
      enable-auto-commit: true
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
    producer:
      bootstrap-servers: AAA.servicebus.windows.net:9093
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
topic:
  name: t-employee

Любое быстрое руководство?

пом.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>kafka-producer-consumer</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>kafka-producer-consumer</name>
    <description>Demo project for Spring Boot</description>
    
    <properties>
        <java.version>1.8</java.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
1
0
309
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Я смог решить эту проблему, повысив ценовой уровень: Стандартный. Это решило эту проблему. Я также получил подсказку отсюда: Не удается подключиться к EventHub через KAFKA api

Другие вопросы по теме