簡體   English   中英

駱駝卡夫卡生產者異常登錄模塊控制標志在 JAAS 配置中不可用

[英]camel kafka producer exception Login module control flag is not available in the JAAS config

我正在通過駱駝從 mqtt 消費並嘗試發布到融合的 kafka,但是當我生產到 kafka 時,我收到以下錯誤

java.lang.IllegalArgumentException: Login module control flag is not available in the JAAS config
    at org.apache.kafka.common.security.JaasConfig.loginModuleControlFlag(JaasConfig.java:85) ~[kafka-clients-3.1.1.jar:na]
    at org.apache.kafka.common.security.JaasConfig.parseAppConfigurationEntry(JaasConfig.java:111) ~[kafka-clients-3.1.1.jar:na]

我用於構建路由 uri 的駱駝配置如下所示

       builder.setScheme("kafka");
       builder.setHost(topicName);
       builder.setParameter("brokers",broker);
       builder.setParameter("saslMechanism","PLAIN");
       builder.setParameter("securityProtocol","SASL_SSL");
       builder.setParameter("saslJaasConfig", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"username\" password=\"Password\";");

我點擊了這個鏈接Camel-Kafka security protocol SASL_SASL not working試圖將 JAAS 配置放在 RAW 中,但它不起作用,即使我試圖將 jaas 屬性外部化,如此處提到的Kafka“登錄模塊未在 JAAS 配置中指定”但我仍然我收到同樣的錯誤,不確定 jaas 配置中缺少什么,或者它是 camel kafka 依賴性問題

我正在使用以下依賴關系圖駱駝版本 2.25.4

<dependencies>
        <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.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>${camel.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-mqtt</artifactId>
            <version>${camel.version}</version>
        </dependency>


        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring-boot</artifactId>
            <version>${camel.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-kafka</artifactId>
            <version>${camel.version}</version>
        </dependency>

    </dependencies>

我一直在想辦法,有什么幫助嗎?

經過一些調試后,我發現當我在 camel 上下文中設置 KafkaComponent 時它可以工作,我在 app.properties 中設置屬性然后我使用 KafkaComponent 並將其設置在 camel 上下文中它能夠獲取屬性,但奇怪的是在構建 uri 時我使用了在我的例子中,它沒有工作的相同屬性看起來像駱駝無法從字符串 uri 中讀取屬性

        KafkaComponent kafka = new KafkaComponent();
        KafkaConfiguration kafkaConfiguration = new KafkaConfiguration();
        kafkaConfiguration.setBrokers(kafkaBrokerUrl);
        kafkaConfiguration.setSaslMechanism(saslmechanism);
        kafkaConfiguration.setSecurityProtocol(saslprotocol);
        kafkaConfiguration.setSaslJaasConfig(kafkajaasconfig);

        kafka.setConfiguration(kafkaConfiguration);

        getContext().addComponent("kafka", kafka);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM