TIL : 230218

JINSEON YE·2023년 2월 18일

TIL

목록 보기
76/88

에러 메세지 :

Field '칼럼' doesn't have a default value 에러

상황 : postman에서 모집글을 생성할 때 response에 categoryId를 넣는데 오류가 뜸. service에서 모집글이 save되는 곳에서 오류가 나서 확인해보니 카테고리가 받아와지긴 하는데 save가 안됨.
이유 : 이미 생성해뒀던 mysql 데이터들이 꼬여서 발생한 문제로 보임.
해결 : application.yml을 creat로 바꿔서 원래 있던 데이터 모두 삭제한 후 재실행.

에러 메세지:

GenericJDBCException: could not execute statement

이유: hibernate에서 자동생성해준 테이블의 인코딩이 문제
해결: yml에서 또는 properties에서 spring.mvc.hibernate.ddl-auto=create 로 설정해놓으면
테이블이 존재하지 않더라도, 쿼리가 실행될 때 테이블을 자동생성 해줌. -> 테이블 인코딩을 utf8로 변경해주기.
ALTER TABLE '테이블명' CONVERT TO CHARSET utf8;

참고

에러 메세지:

[Error] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; 
nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [com.example.party.category.entity.Category]: 
Constructor threw exception; nested exception is 
java.lang.NullPointerException: Cannot invoke 
"com.example.party.category.dto.CategoryRequest.getName()" because "request" is null] with root cause

이유: Repository를 초기화하지 않았기 때문에 발생한 오류
해결: @Autowired annotation을 통해 Repository를 초기화하거나 create 로 변경

commit은 했는데 push는 안 한 상태의 commit mesage 변경하기 (커밋한 메세지 명 변경하기)
: git commit --amend -m "commit_message"

터미널 에러메세지: E325:ATTENTION
상황: commit 메세지 수정하다가 에러남
해결: 실수로 생성된 swp파일을 찾아서 삭제하기

참고

profile
백엔드 개발자

0개의 댓글