Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kafka failure strategy dead-letter-topic unable to create an instance of Json serializer class #47188

Open
csemaan1A opened this issue Apr 4, 2025 · 2 comments
Assignees
Labels

Comments

@csemaan1A
Copy link

csemaan1A commented Apr 4, 2025

Describe the bug

We encountered an issue with our Quarkus application when defining a dead-letter-queue as the failure strategy and using a JSON serializer for a custom Ping class generated by Quarkus. The application fails to start only when deployed in a Kubernetes environment. The error message indicates that the Ping_Serializer_xxx class cannot be found.

Expected behavior

The application should start successfully in the Kubernetes environment without any errors. It should correctly initialize all necessary components, including the JSON serializer for the custom Ping class.

Actual behavior

The application fails to start when deployed in a Kubernetes environment. The error message indicates that the Ping_Serializer_xxx class cannot be found. The stack trace shows an IllegalArgumentException caused by the inability to create an instance of the Ping_Serializer class, followed by a ClassNotFoundException for the same class. This issue does not occur when running the Quarkus test in a local environment

How to Reproduce?

Attached you can find a reproducer on Quarkus 3.20.0 with some instruction in the README in how to reproduce it.

Simply build the project with the command:

mvn clean install

Then deploy the application in a Kubernetes environment with the command:

kubectl apply -f kubernetes.yml

quarkus-messaging-dlq.zip

Output of uname -a or ver

No response

Output of java -version

Java version: 21.0.5, vendor: Red Hat, Inc

Quarkus version or git rev

3.8, 3.15, 3.20

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.4

Additional information

No response

@csemaan1A csemaan1A added the kind/bug Something isn't working label Apr 4, 2025
Copy link

quarkus-bot bot commented Apr 4, 2025

/cc @alesj (kafka), @cescoffier (kafka), @geoand (kubernetes), @iocanel (kubernetes), @ozangunalp (kafka)

@ozangunalp
Copy link
Contributor

The dlq value serializer is only generated if failure-strategy=dead-letter-queue is set at build time (ie. at compilation).
This follows the Quarkus build-time principle. If you set the strategy only at runtime, Quarkus doesn't generate the serde classes.

The workaround is either to set the failure-strategy=dead-letter-queue in application.properties or if you must set the strategy at runtime, implement the serializer and set the dead-letter-queue.value.serializer yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants