gpt4 book ai didi

java - Spring启动Apache kafka Binder 项目,application.properties spring.cloud.stream.kafka.binder。 jaas 属性未知

转载 作者:行者123 更新时间:2023-11-30 06:27:20 29 4
gpt4 key购买 nike

我的项目 application.properties 发出警告。说

'spring.cloud.stream.kafka.binder.jaas.loginModule' is an unknown property.

下面给出了我的项目 .pom 文件

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shiwantha.test</groupId>
<artifactId>KafkaTestOne</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-parent</artifactId>
<version>1.1.0.RC2</version>
</parent>

<properties>
<java.version>1.8</java.version>
<spring-kafka.version>1.1.1.RELEASE</spring-kafka.version>
<spring-integration-kafka.version>2.1.0.RELEASE</spring-integration-kafka.version>
<kafka.version>0.10.0.0</kafka.version>
</properties>


<dependencies>
<!-- spring-boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-kafka</artifactId>

</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>

<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
<version>1.1.0.RC2</version>
</dependency>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-security</artifactId>

</dependency>
<dependency>

<groupId>org.springframework.security</groupId>

<artifactId>spring-security-test</artifactId>

<scope>test</scope>

</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

</dependencies>



<build>
<plugins>
<!-- spring-boot-maven-plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

我想创建一个 spring boot kafka 消费者应用程序,它与使用 kerberos 保护的 kafka 集群进行通信。我有 key 表文件。和 kafka 服务器信息。

spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT
spring.cloud.stream.kafka.binder.brokers = 10.48.148.44,10.48.148.45,10.48.148.46,10.48.148.47
spring.cloud.stream.kafka.bindings.input.consumer.autoCommitOffset = false



spring.cloud.stream.kafka.binder.jaas.loginModule = com.sun.security.auth.module.Krb5LoginModule
spring.cloud.stream.kafka.binder.jaas.controlFlag = required
spring.cloud.stream.kafka.binder.jaas.options.useKeyTab = true
spring.cloud.stream.kafka.binder.jaas.options.storeKey = true
spring.cloud.stream.kafka.binder.jaas.options.keyTab = src/main/resources/gitcc_kafka_user.keytab
spring.cloud.stream.kafka.binder.jaas.options.principal = gitcc_kafka_user@DIALOG.DIALOGGSM.COM

请帮助我克服这些问题。我是新来的 。所以请您提供使用受kerberos保护的kafka服务器的示例项目

最佳答案

这对我来说效果很好;您可以看到在调试器中设置的属性...

@SpringBootApplication
@EnableBinding(Sink.class)
public class So46903311Application {

public static void main(String[] args) {
SpringApplication.run(So46903311Application.class, args);
}

}

spring.cloud.stream.kafka.binder.jaas.loginModule=testForSo46903311
spring.cloud.stream.kafka.binder.brokers=localhost:9092

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR4</spring-cloud.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-core</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

STS Debugger

关于java - Spring启动Apache kafka Binder 项目,application.properties spring.cloud.stream.kafka.binder。 jaas 属性未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46903311/

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