HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🌚
[New] 우기팀
/
HttpMessageConversionException + InvalidDefinitionException
HttpMessageConversionException + InvalidDefinitionException
HttpMessageConversionException + InvalidDefinitionException

HttpMessageConversionException + InvalidDefinitionException

간단 요약 / 비고
작성일
May 16, 2022
작성자
기술 태그
예외처리
API
엔티티를 직접 반환하는 API를 만들다 보면 만날 수 있는 예외
 
주문 전체 조회 api 호출 →
예외 발생 →
에러 메세지
2022-05-16 20:37:52.864 ERROR 2534 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException : Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0] ->com.study.jpql.lecture.domain.Order["customer"] ->com.study.jpql.lecture.domain.Customer$HibernateProxy$l2PhS7GN["hibernateLazyInitializer"])
잭슨 : 주문객체를 json 으로 만들자
→ 첫번째 주문의 ArrayList[0]
→ 고객의 Order[”customer”]
→ 고객 = ByteBuddyInterceptor(프록시) Customer$HibernateProxy$l2PhS7GN["hibernateLazyInitializer"]
 
잭슨 : 얘는 내가 못 해주겠는걸?
잭슨이 하이버네이트 프록시 (bytebuddy)를 처리하기 위해선 추가적인 모듈 설치후 빈 등록 필요
Jackson Datatype Hibernate5

 
사실 dto 를 사용하면 잭슨이 프록시를 처리할 가능성을 미연에 막을 수 있기때문에 이런 에러를 만나지 않는다.