# Error Produce Avro Records example in Confluent Cloud

**URL:** <https://forum.confluent.io/t/error-produce-avro-records-example-in-confluent-cloud/4368>\
**Category:** Confluent Cloud\
**Created:** [6 March 2022 10:40 UTC](https://forum.confluent.io/t/error-produce-avro-records-example-in-confluent-cloud/4368 "2022-03-06T10:40:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidleongz](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@davidleongz](https://forum.confluent.io/u/davidleongz)\
**Post date:** [6 March 2022 10:40 UTC](https://forum.confluent.io/t/error-produce-avro-records-example-in-confluent-cloud/4368/1 "2022-03-06T10:40:36Z")

</div>

I’m trying execute this command from this tutorial:  
[https://docs.confluent.io/platform/current/tutorials/examples/clients/docs/java.html](https://docs.confluent.io/platform/current/tutorials/examples/clients/docs/java.html)

```auto
mvn exec:java -Dexec.mainClass="io.confluent.examples.clients.cloud.ProducerAvroExample" -Dexec.args="$HOME/.confluent/java.config test2"

```

And return this error:

```auto
Caused by: org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient
    at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal (KafkaAdminClient.java:537)
    at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal (KafkaAdminClient.java:469)
    at org.apache.kafka.clients.admin.Admin.create (Admin.java:133)
    at org.apache.kafka.clients.admin.AdminClient.create (AdminClient.java:39)
    at io.confluent.examples.clients.cloud.ProducerAvroExample.createTopic (ProducerAvroExample.java:49)
    at io.confluent.examples.clients.cloud.ProducerAvroExample.main (ProducerAvroExample.java:73)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:297)
    at java.lang.Thread.run (Thread.java:829)
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)

```

Could you please advice how to solve this error?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![rick](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rick/32/49_2.png) [@rick](https://forum.confluent.io/u/rick)\
**Post date:** [6 March 2022 20:26 UTC](https://forum.confluent.io/t/error-produce-avro-records-example-in-confluent-cloud/4368/2 "2022-03-06T20:26:31Z")

</div>

@davidleongz Welcome to the forum.

This exception is thrown when the Jaas configuration cannot be properly parsed ([kafka source](https://github.com/apache/kafka/blob/7c29c5013dd16597727ea5483c89b60b2b517bde/clients/src/main/java/org/apache/kafka/common/security/JaasConfig.java#L66)). I would double check the `sasl.jaas.config` value and ensure it follows this pattern including the spaces, quotes and semicolon.

```auto
org.apache.kafka.common.security.plain.PlainLoginModule required username='<key>' password='secret';

```

Here is another example that configures Java Consumers for Confluent Cloud if you’d like to compare the examples for a potential issue / difference:

> **[Apache Kafka and Java - Getting Started Tutorial](https://developer.confluent.io/get-started/java/#introduction)**
>
> How to run a Kafka client application written in Java that produces to and consumes messages from a Kafka cluster, with step-by-step setup instructions and examples.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [21 March 2022 14:51 UTC](https://forum.confluent.io/t/error-produce-avro-records-example-in-confluent-cloud/4368/3 "2022-03-21T14:51:15Z")

</div>

Closed on 21 March 2022 14:51 UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
