# Zeebe Exporter: ClassCastException with Uber JAR; Lightweight JAR Works Fine

**URL:** <https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912>\
**Category:** Camunda 8 Topics\
**Tags:** zeebe\
**Created:** [May 8, 2025, 12:48pm UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912 "2025-05-08T12:48:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinugaud](https://forum.camunda.io/user_avatar/forum.camunda.io/sinugaud/32/29634_2.png) [@sinugaud](https://forum.camunda.io/u/sinugaud)\
**Post date:** [May 8, 2025, 12:48pm UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/1 "2025-05-08T12:48:58Z")

</div>

I’ve developed a custom Zeebe exporter and tried packaging it in two ways:

- ✅ **Lightweight JAR (no dependencies)**: Works perfectly when added to Zeebe.
- ❌ **Uber JAR (with dependencies)**: Fails at runtime with a `ClassCastException`.

In some cases, I have external dependencies that my exporter relies on, so I **must use a JAR with dependencies**. However, using an uber JAR seems to cause classloading issues in Zeebe.

**Questions:**

1. Does Zeebe only support lightweight (non-fat) JARs for exporters?
2. What is the correct or recommended way to include dependencies with a Zeebe exporter to avoid these issues?

---

<div class="post-metadata">

**Author:** ![sinugaud](https://forum.camunda.io/user_avatar/forum.camunda.io/sinugaud/32/29634_2.png) [@sinugaud](https://forum.camunda.io/u/sinugaud)\
**Post date:** [May 9, 2025, 7:50am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/2 "2025-05-09T07:50:20Z")

</div>

> **[GitHub - sinugaud/kafka-incident-exporter](https://github.com/sinugaud/kafka-incident-exporter)**
>
> Contribute to sinugaud/kafka-incident-exporter development by creating an account on GitHub.

Resolved class cast exception, but exporter hasn’t opened.  
@jonathan.lukas

---

<div class="post-metadata">

**Author:** ![jonathan.lukas](https://forum.camunda.io/user_avatar/forum.camunda.io/jonathan.lukas/32/14911_2.png) [@jonathan.lukas](https://forum.camunda.io/u/jonathan.lukas)\
**Post date:** [May 12, 2025, 5:12am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/3 "2025-05-12T05:12:36Z")

</div>

Hello @sinugaud ,

the exporter yaml has an issue:

> <https://github.com/sinugaud/kafka-incident-exporter/blob/7c9ecdba816044eb3a989ba9f7da9128b4170ff1/exporter.yml#L5>

This line should be omitted, the property is `zeebe.broker.exporters.<exporterName>`, no need to nest `exporter` inside.

Please see this docs for an example:

> **[Install Zeebe exporters | Camunda 8 Docs](https://docs.camunda.io/docs/self-managed/zeebe-deployment/exporters/install-zeebe-exporters/)**
>
> Add dynamic exporters to Zeebe brokers in Camunda 8 Self-Managed deployment.

Here is an outline on the full configuration:

> **[Broker configuration | Camunda 8 Docs](https://docs.camunda.io/docs/self-managed/zeebe-deployment/configuration/broker-config/#zeebebrokerexporters)**
>
> Let's analyze how to configure the Zeebe Broker

Best regards,  
Jonathan

---

<div class="post-metadata">

**Author:** ![sinugaud](https://forum.camunda.io/user_avatar/forum.camunda.io/sinugaud/32/29634_2.png) [@sinugaud](https://forum.camunda.io/u/sinugaud)\
**Post date:** [May 12, 2025, 9:17am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/4 "2025-05-12T09:17:45Z")

</div>

I’m trying to configure a custom Kafka exporter in my Zeebe broker using the following YAML:

```yaml
zeebe:
  broker:
    exporters:
      KafkaExporter:
        className: com.example.exporter.kafka.KafkaExporter
        jarPath: /usr/local/zeebe/exporters/zeebe-kafka-exporter.jar

```

However, I’m encountering the following exception during broker startup:

```auto
Caused by: io.camunda.zeebe.broker.exporter.repo.ExporterLoadException: Cannot load exporter [KafkaExporter]: cannot load specified class
Caused by: java.lang.ClassCastException: class com.example.exporter.kafka.KafkaExporter

```

I also tried renaming the exporter entry to a more generic name like `kafka`:

```yaml
zeebe:
  broker:
    exporters:
      kafka:
        className: com.example.exporter.kafka.KafkaExporter
        jarPath: /usr/local/zeebe/exporters/zeebe-kafka-exporter.jar

```

But I still get the same error:

```auto
Caused by: io.camunda.zeebe.broker.exporter.repo.ExporterLoadException: Cannot load exporter [kafka]: cannot load specified class
Caused by: java.lang.ClassCastException: class com.example.exporter.kafka.KafkaExporter

```

* * *

I’m unsure what the exporter name should be in the YAML file based on the class.  
I’m not able to figure it out from the current setup.

Can you guide me on how to determine the correct `className` and what the exporter name should be in the configuration?

* * *

Here’s what I’ve observed:  
✅ If I package the exporter as a **lightweight JAR** (without dependencies), it works fine.  
❌ But when I build a **fat JAR** (including all dependencies), the Zeebe broker throws a `ClassCastException` for the exporter class.

* * *

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jonathan.lukas](https://forum.camunda.io/user_avatar/forum.camunda.io/jonathan.lukas/32/14911_2.png) [@jonathan.lukas](https://forum.camunda.io/u/jonathan.lukas)\
**Post date:** [May 13, 2025, 4:48am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/5 "2025-05-13T04:48:11Z")

</div>

Hello @sinugaud ,

please put your exporter api dependency in provided scope to prevent it from being added to your fat jar:

> <https://github.com/sinugaud/kafka-incident-exporter/blob/471e971dce976343ed95cb7d53359eb16c12f563/pom.xml#L19-L23>

Due to your shading, it will be added to the fat jar, leading to a duplicate Exporter interface class that will not be recognised as the actual exporter class.

Best regards,  
Jonathan

---

<div class="post-metadata">

**Author:** ![sinugaud](https://forum.camunda.io/user_avatar/forum.camunda.io/sinugaud/32/29634_2.png) [@sinugaud](https://forum.camunda.io/u/sinugaud)\
**Post date:** [May 13, 2025, 6:14am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/6 "2025-05-13T06:14:21Z")

</div>

I tried with the updated `scope`, and now I’m no longer getting the `ClassCastException` when running the fat JAR. However, the exporter still haven’t open — there’s no activity or logs indicating it was picked up.

Any idea what might still be missing?

---

<div class="post-metadata">

**Author:** ![jonathan.lukas](https://forum.camunda.io/user_avatar/forum.camunda.io/jonathan.lukas/32/14911_2.png) [@jonathan.lukas](https://forum.camunda.io/u/jonathan.lukas)\
**Post date:** [May 13, 2025, 6:17am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/7 "2025-05-13T06:17:28Z")

</div>

Hello @sinugaud ,

I would also set your logging stuff to provided scope to ensure the same logger is used.

Best regards,  
Jonathan

---

<div class="post-metadata">

**Author:** ![sinugaud](https://forum.camunda.io/user_avatar/forum.camunda.io/sinugaud/32/29634_2.png) [@sinugaud](https://forum.camunda.io/u/sinugaud)\
**Post date:** [May 13, 2025, 6:41am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/8 "2025-05-13T06:41:34Z")

</div>

> [@jonathan.lukas](#):
>
> I would also set your logging stuff to provided scope to ensure the same logger is used.

Thanks Buddy  
Its works for me

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [May 20, 2025, 6:41am UTC](https://forum.camunda.io/t/zeebe-exporter-classcastexception-with-uber-jar-lightweight-jar-works-fine/61912/9 "2025-05-20T06:41:50Z")

</div>

Closed on May 20, 2025, 6:41am UTC

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