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

Can't deserialize class StepContribution #4535

Open
iKopranov opened this issue Jan 22, 2024 · 2 comments
Open

Can't deserialize class StepContribution #4535

iKopranov opened this issue Jan 22, 2024 · 2 comments
Labels
status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter

Comments

@iKopranov
Copy link

Class StepContribution is Serializable however it doesn't have assigned serialVersionUID field. I encountered an issue when I implemented Spring Batch Remote feature with different spring boot versions in microservices using this feature

public class StepContribution implements Serializable {

Consumer exception java.io.InvalidClassException: org.springframework.batch.core.StepContribution; local class incompatible: stream classdesc serialVersionUID = 8115798873141271089, local class serialVersionUID = -3004412810934832110 at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:728) ~[na:na] at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2060) ~[na:na] at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1907) ~[na:na] at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2209) ~[na:na] at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1742) ~[na:na] at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2584) ~[na:na] at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2442) ~[na:na] at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2242) ~[na:na] at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1742) ~[na:na] at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:514) ~[na:na] at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:472) ~[na:na] at org.apache.commons.lang3.SerializationUtils.deserialize(SerializationUtils.java:215) ~[commons-lang3-3.12.0.jar:3.12.0] ... 26 common frames omitted

@harishdalm
Copy link

Any update on this ? When this will be resolved

@fmbenhassine
Copy link
Contributor

Can you please elaborate on how/when this issue happens? I don't remember having such issue when implementing remote partitioning. I see org.apache.commons.lang3.SerializationUtils in the stacktrace, but can you tell us which serialisation library/mechanism and which message broker do you use?

We might add a default serialVersionUID to StepContribution, but according to the javadoc of Serializable:

If a serializable class does not explicitly declare a serialVersionUID, then the serialization
runtime will calculate a default serialVersionUID value for that class based on various aspects
of the class

that's why I would like to first know in which situation and with which serialization runtime you have this issue. Thank you.

@fmbenhassine fmbenhassine added the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants