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
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
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
i am using following dependency chart camel version 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
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.