Back-end/Spring

[Spring] 오류 목록

yujin0517 2023. 4. 18. 17:33

1. thymeleaf 오류

WARN 14128 --- [           main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)

클래스 실행할 때 WERN이 뜨길래 확인해 봤다. template 폴더 아래 index.html (Welcome Page)를 추가해 주니 해결되었다.

 

 

2.  SQL 구문 오류 

jakarta.persistence.PersistenceException: Converting `org.hibernate.exception.SQLGrammarException` to JPA `PersistenceException` : could not prepare statement

결론적으로 기본키에 전략 설정을 해주지 않아서 오류가 발생했다. 

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)

id를 기본키로 설정하고, id 값이 자동으로 1씩 증가하도록 테이블을 설계했다. 

하지만 @GeneratedValue 옵션 중 전략을 정하는 옵션을 설정해주지 않아 id 값을 넣는 과정에서 오류가 난 것 같다. 

전략의 종류에는 AUTO, IDENTITY, SEQUENCE, TABLE 등 4가지가 있다. 

 

3. 서버 정지 시 오류 발생

이 오류는 코드상의 문제보다는 환경설정의 문제이다. (실제로 프로젝트를 실행하고 빌드 후 바로 실행한 화면이라 코드는 건드린게 없다.)

 

Build and run using, Run tests using 부분을 IntelliJ IDEA로 변경 후 Apply 해주면 오류 해결!

 

오류 발생 시 수정예정...