kloadgen
kloadgen copied to clipboard
Failing to connect to Kafka
Hi, Trying to make a connection to Kafka and produce message(son) to a topic but failing to connect.
Whilst sending a message using JMeter below issues are seen Kafka producer is closing with timeout=0ms Login module control flag not specified in JAAS config.
Please find the login specified in jaas.conf
Have tried all the possible ways in defining the credentials in config file but didn't worked, would appreciate your help in sorting the issue?
Thanks
KloadGen Version
Kloadgen-3.5.3
Relevant log output
INFO o.a.k.c.p.KafkaProducer: [Producer clientId=perf-test] Closing the Kafka producer with timeoutMillis = 0 ms.
2022-04-28 11:04:20,547 INFO o.a.k.c.m.Metrics: Metrics scheduler closed
2022-04-28 11:04:20,547 INFO o.a.k.c.m.Metrics: Closing reporter org.apache.kafka.common.metrics.JmxReporter
2022-04-28 11:04:20,547 INFO o.a.k.c.m.Metrics: Metrics reporters closed
2022-04-28 11:04:20,547 INFO o.a.k.c.u.AppInfoParser: App info kafka.producer for perf-test unregistered
2022-04-28 11:04:20,548 ERROR o.a.j.p.j.s.AbstractJavaSamplerClient: Failed to construct kafka producer
org.apache.kafka.common.KafkaException: Failed to construct kafka producer
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:440) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:291) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:318) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:303) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at net.coru.kloadgen.sampler.KafkaSchemaSampler.setupTest(KafkaSchemaSampler.java:113) [kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:194) [ApacheJMeter_java.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.IllegalArgumentException: Login module control flag not specified in JAAS config
at org.apache.kafka.common.security.JaasConfig.parseAppConfigurationEntry(JaasConfig.java:110) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.common.security.JaasConfig.<init>(JaasConfig.java:63) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:88) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:82) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:167) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:81) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:105) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.clients.producer.KafkaProducer.newSender(KafkaProducer.java:448) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:429) ~[kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
... 10 more
2022-04-28 11:04:20,552 ERROR o.a.j.p.j.s.AbstractJavaSamplerClient: Failed to send message
java.lang.NullPointerException: Cannot invoke "org.apache.kafka.clients.producer.KafkaProducer.send(org.apache.kafka.clients.producer.ProducerRecord, org.apache.kafka.clients.producer.Callback)" because "this.producer" is null
at net.coru.kloadgen.sampler.KafkaSchemaSampler.runTest(KafkaSchemaSampler.java:153) [kloadgen-3.5.3-kloadgen-plugin-3.5.3.jar:?]
at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:197) [ApacheJMeter_java.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
at java.lang.Thread.run(Thread.java:833) [?:?]
2022-04-28 11:04:20,553 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group - KLoadgen 1-1
2022-04-28 11:04:20,553 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group - KLoadgen 1-1
2022-04-28 11:04:20,553 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2022-04-28 11:04:20,554 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
Have you added your JMX Testplan or a replica?
- [X] I have added a JMX testplan
Have you added your Schema or a replica?
- [X] I have added the Schema



Thank you for collaborating with the project by giving us feedback!!' You will help us a lot if you can attach an example AVRO and an example Test Plan in order to be able to reproduce the error, if that is the case. Cheers
Hi @ShantiSumanth
Thank you for your collaboration, we will review it and the changes/progress that we are making will inform you here.
Thanks @cmunozgomez.
Hi @ShantiSumanth
We are currently reviewing the issue. We'll inform you as soon as we get a solution.
Hi @ShantiSumanth We have problems reading the config from a jaas.conf file, try to set the kafka client auth from the jaas.conf file in the java.security.auth.login.config property of the java request. It must be a single line string like this:
KafkaClient { org.apache.kafka.common.security.plain.PlainLoginModule required username=(xxxx) password=(+dljlsjfl); };
Hi @pedror19,
I've already included Kafka client auth in java request and added auth in a single line string but didn't work.
.
Could you please look into this again.
Thanks
Hi @ShantiSumanth,
We will review the problem again and you will be in formed as soon as we made some improvement.
Hi again @ShantiSumanth, We figured out that you are still using the jass.conf file, you need to write the config like this.
Hello @pedror19,
I've added the Kafka auth details in the java request and it is throwing java.io.ioexception
Hello again @ShantiSumanth. We will review again your problem and inform you about any improvement as soon as posible
Hi @ShantiSumanth ,
We've noticed that you are using the 3.5.3 version of KLoadGen, can you update and use the lastest version? We will continue searching for the problem, but it'd be great if you can update so we can be sure the problem is not because of an old version. One more thing, can you tell us where are you locating the jass.conf file?
Hi @ShantiSumanth,
we were playing around a bit with Kafka Authentication, and notice you need to pass the absolute path in the java.security.auth.login.config property. It also works if you put the module configuration in a line like my colleague @pedror19 said, but, without the KafkaClient part, neither the '{'.
Can you please try after update to the latest version (if possible)?
Hi @ShantiSumanth, Adding to what @jemacineiras said you need to add to the java.security.auth.login.config the serviceName field like this:
org.apache.kafka.common.security.plain.PlainLoginModule required serviceName="yourServiceName" username="(xxxxx)" password="(+dljlsjfl)";
Thanks @pedror19 @jgbriz @jemacineiras . I'm trying to get latest version of kloadgen plugin but failing to build the project. if possible would you mind providing me with latest version of kloadgen plugin please?
Thanks
Hi @ShantiSumanth, Every version is deployed automatically to maven central repository, you can download the latest version from there.
Thanks @pedror19.
Ran script with latest version but still failing with same error(java.io exception and login module control flag not specified).
@jgbriz , jaas.conf file is located in jmeter/bin folder so given config file name directly in the request.
Adding file name in java request is throwing error " java.lang.IllegalArgumentException: Login module control flag not specified in JAAS config"
giving authentication as a single string in the request is failing with exception, " java.io.IOException:org.apache.kafka.common.security.plain.PlainLoginModule required serviceName="yourServiceName" username="(xxxxx)" password="(+dljlsjfl)"; (No such file or directory)".

Thanks
Hello @ShantiSumanth , Thank you for the information, we'll look into it.
Hello @ShantiSumanth,
We have tested the connection and we had no problems adding to the java.security.auth.login.config the absolute path of the jaas file and the connection string directly in that field as we said previously.
Hi @pedror19,
Any update on this please?
Thanks
Hello @ShantiSumanth, Have you tested the configuration above?
Hi @pedror19 ,
Sorry missed updating. Don't see login module error but failing with java.lang.SecurityException: java.io.IOException: Configuration Error.

Also have below issue whilst adding Value Schema file load generator config ERROR o.a.j.u.JMeterUtils: Cannot invoke "String.toLowerCase()" because the return value of "com.fasterxml.jackson.databind.JsonNode.textValue()" is null.
Thanks
Hello @ShantiSumanth
We will look into it
Hello @ShantiSumanth ,
Can you give us more detailed information regarding the error?, so we can dig more into the problem.
Hello @ShantiSumanth , We need more information about the error you are getting, so we can have a better look trying to get the cause of the problem.
Hi @jgbriz, Apologies, lost my project so building the script again. Will give detailed information on error by eod.
Thanks
Hi @ShantiSumanth No problem. In that case, I think it's better option to close this issue, and to reopen one in case you have other problems.
Hi @jgbriz, Experiencing two issues now,
- failing to open Value Schema File Load Generator config. fyi... Loaded json file (file content screenshot
attached)
- throwing java.io.IOException: Configuration Error, config error , think it is complaining about json file but the file is valid without errors. error details below,
Caused by: java.lang.SecurityException: java.io.IOException: Configuration Error:
Line 14: expected [option key], found [null]
at sun.security.provider.ConfigFile$Spi.
(ConfigFile.java:139) ~[?:?] at sun.security.provider.ConfigFile. (ConfigFile.java:104) ~[?:?] at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] at java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) ~[?:?] at jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347) ~[?:?] at java.lang.Class.newInstance(Class.java:645) ~[?:?] at javax.security.auth.login.Configuration$2.run(Configuration.java:258) ~[?:?] at javax.security.auth.login.Configuration$2.run(Configuration.java:249) ~[?:?] at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]

Please let me know if further details required for investigating.
Thanks
Hi @ShantiSumanth , We'll look into it.
Hi @ShantiSumanth,
please, can you provide the required files in order to reproduce the error? We are going to need the .jmx and .avsc ( or json schema) file you are using, or similar, in order to investigate and understand where is the problem.
Cheers
Hi @jemacineiras, please find attached json and imx files jsonfile.json.zip CatalogueService-07June2022.jmx.zip Thanks