简体   繁体   English

骆驼卡夫卡生产者异常登录模块控制标志在 JAAS 配置中不可用

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

i am consuming from mqtt through camel and trying to publish to confluent kafka, but when i produce to kafka i get the following error我正在通过骆驼从 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]

my camel config for building route uri looks like this我用于构建路由 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\";");

i followed this link Camel-Kafka security protocol SASL_SASL not working tried to put JAAS config in RAW but it doesn't work, even i tried to externalize the jaas property as mentioned here Kafka "Login module not specified in JAAS config" but still i am getting the same error not sure what is missing in jaas config or its a problem with camel kafka dependency我点击了这个链接Camel-Kafka security protocol SASL_SASL not working试图将 JAAS 配置放在 RAW 中,但它不起作用,即使我试图将 jaas 属性外部化,如此处提到的Kafka“登录模块未在 JAAS 配置中指定”但我仍然我收到同样的错误,不确定 jaas 配置中缺少什么,或者它是 camel kafka 依赖性问题

i am using following dependency chart camel version 2.25.4我正在使用以下依赖关系图骆驼版本 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>

i have been stuck figuring out, any help?我一直在想办法,有什么帮助吗?

After some debuggiing i found that it works when i set up KafkaComponent in camel context, i set up properties in app.properties then i used KafkaComponent and set it in camel context it was able to take properties, but strangely while building uri i used the same property it didn't worked looks like camel is not able to read property from string uri in my case经过一些调试后,我发现当我在 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