If you are using Spring Boot + Data JPA and Caching, like Redis Cache, you will get the above exception if you do not serialize your Entity or POJO classes.
Fix/Solution:
Your Entiry class needs to have implements Serializable with a serialVersionUID field.
Example: Change this:
@Entity
public class DbUser {
public DbUser(int userId, String userName) {
this.userId = userId;
this.userName = userName;
}
To this,
import java.io.Serializable;
@Entity
public class DbUser implements Serializable {
private static final long serialVersionUID = 1L;
public DbUser(int userId, String userName) {
this.userId = userId;
this.userName = userName;
}

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!