ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' 에러해결
    게시판 만들기(modoo-board) 2023. 11. 28. 17:53

    에러 로그

    org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'entityManagerFactory' 
    defined in class path resource 
    [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: 
    Invocation of init method failed; 
    nested exception is 
    org.hibernate.AnnotationException: Unable to map collection 
    com.modooboard.member.entity.Member.roles

    - 애플리케이션을 돌리려는데 갑자기 위와 같은 에러가 발생하였다. 로그를 읽어보니 entityManagerFactory 빈을 생성하는데 에러가 발생하였다는 내용이었다. EntityManagerFactory 관련해서 코드를 바꾼적이 없어서 왜 갑자기 이러한 에러가 발생하였을까 고민하다가 중첩된 에러를 보니 회원 엔티티의 roles 필드에서 AnnotationException이 발생하였다는 로그를 확인하였다.

     

     

    - 해당 코드를 수정한 적이 없는데 왜 에러가 발생하였을까 하다가 Unable to map collection 이라는 에러 로그를 보고 매핑이 안될만한 부분은 referencedColumnName 밖에 없었고 해당 엔티티의 id 이름을 member_id로 바꾼 것이 문제였다.

     

    - 이 부분이 문제!

     

    - 이렇게 바꿔주니 해결되었다.

Designed by Tistory.