繁体   English   中英

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

[英]Spring boot Apache kafka binder project, application.properties spring.cloud.stream.kafka.binder. jaas properties are unknown

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

'spring.cloud.stream.kafka.binder.jaas.loginModule' 是一个未知的属性。

我的项目 .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 集群进行通信。 我有密钥表文件。 和 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 调试器

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM