Skip to content

Conversation

noojung
Copy link
Contributor

@noojung noojung commented Jun 5, 2025

Using Jackson2ExecutionContextStringSerializer causes KafkaItemReader to throw a ClassCastException.

Because KafkaItemReader stores a Map<TopicPartition, Long> in the ExecutionContext, the serializer converts all map keys to strings.

To fix this, I changed it to store only the partition number (as a string) instead of the full TopicPartition object.

Resolves: #3797

@noojung noojung changed the title Fix KafkaItemReader ExecutionContext deserialization error when using Jackson2ExecutionContextStringSerializer Fix KafkaItemReader ExecutionContext deserialization error Jul 31, 2025
@noojung noojung changed the title Fix KafkaItemReader ExecutionContext deserialization error Fix KafkaItemReader deserialization error when loading ExecutionContext Jul 31, 2025
@noojung noojung changed the title Fix KafkaItemReader deserialization error when loading ExecutionContext Fix KafkaItemReader ClassCastException during ExecutionContext deserialization Jul 31, 2025
@fmbenhassine
Copy link
Contributor

fmbenhassine commented Oct 16, 2025

Using Jackson2ExecutionContextStringSerializer causes KafkaItemReader to throw a ClassCastException.

Jackson2ExecutionContextStringSerializer is deprecated in favor of JacksonExecutionContextStringSerializer (based on Jackson 3, see #4842). Can you please try with the new serializer and see if the issue persists?

@fmbenhassine fmbenhassine added the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Oct 16, 2025
@noojung
Copy link
Contributor Author

noojung commented Oct 16, 2025

@fmbenhassine I've tested it, and the same ClassCastException still occurs with the new serializer.

I've written a sample test case on my branch: noojung@b3ec35d

Please let me know if you have any feedback.

@fmbenhassine fmbenhassine added status: feedback-provided Issues for which the feedback requested from the reporter was provided and removed status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter labels Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: feedback-provided Issues for which the feedback requested from the reporter was provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot deserialize TopicPartition from JobRepository

2 participants