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:
Does Zeebe only support lightweight (non-fat) JARs for exporters?
What is the correct or recommended way to include dependencies with a Zeebe exporter to avoid these issues?
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.
please put your exporter api dependency in provided scope to prevent it from being added to your fat jar:
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.
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.