Framework/Spring Boot

[Error] org.springframework.data.redis.serializer.SerializationException

잔망루피 2022. 7. 12. 19:53
반응형
org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: Bulletin.Board.domain.posts.Post
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: Bulletin.Board.domain.posts.Post
Caused by: java.io.NotSerializableException: Bulletin.Board.domain.posts.Post

에러로그

 

 

👑 해결

Post 엔티티에 implements Serializable을 추가했다.

@Entity
@Getter
@NoArgsConstructor
public class Post extends BaseTimeEntity implements Serializable{
	// 생략
}

Serialization객체바이너리 데이터변환하는 것

반대의 과정이 Deserialization

Serializable 인터페이스를 구현하지 않은 클래스의 상태는 Serialized 또는 deserialized에 해당하지 않는다.

Serializable 인터페이스에는 메소드, 필드가 없다. 단지, 직렬화를 할 수 있는지 식별하는 용도다.

 

 

참고 👇

https://somida.tistory.com/188

 

[Error] DefaultSerializer requires a Serializable payload but received an object of type

1. Spring Boot + Redis 세션 저장 시 Serializable 문제 org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.supp..

somida.tistory.com

 

https://medium.com/@betul5634/redis-serialization-with-spring-redis-data-lettuce-codec-1a1d2bc73d26

 

Redis Serialization with Spring Redis Data/Lettuce Codec

Hi, here is the third part of “Hybrid Session Management with Sticky Session and Redis” story series. In this article we are going to learn…

medium.com

https://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html

 

Serializable (Java Platform SE 7 )

Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselve

docs.oracle.com

 

반응형