728x90

🟦 기본 환경: IDE: IntelliJ, Language: Java

 

 

발생 Error

SpringBoot에서 다음 Source Code를 실행할 경우,

🚨다음과 같은 Error 발생

nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service

 

 

발생 원인

H2 DB를 실행하지 않고 Test 진행

 

 

해결 방법

H2 DB를 실행

1. cmd 상 h2 DB가 설치된 위치로 이동 후, h2.sh 또는 h2.bat 실행

2. H2 콘솔 페이지 로드 시, 연결 버튼 클릭

 

 

 

참고 자료

 

Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] 에러 - 인프런 | 질문 & 답변

제가 오랜만에 강의를 들어와서 진행하고 있습니다Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]이 에러가 발생하는데 h2 데이터베이스 연결은 했는데요제 applicat...

www.inflearn.com

 

 

H2 Database 설치, 서버 실행, 접속 방법 (Windows, MacOS)

H2 Database 설치, 서버 실행, 접속 방법 (Windows, MacOS) H2 데이터베이스는 설치가 필요 없고 용량이 매우 가벼우며 웹용 콘솔(쿼리툴)을 제공하여 개발용 로컬 DB로 사용하기 좋은 데이터베이스이다. H

atoz-develop.tistory.com

 

728x90
728x90

🟦 기본 환경: IDE: IntelliJ, Language: Java

 

 

발생 Error

SpringBoot에서 다음 Source Code를 실행할 경우,

🚨다음과 같은 Error 발생

could not prepare statement; SQL [call next value for hibernate_sequence];

nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement

 

 

발생 원인

환경 설정 파일 application.yml에서 띄어쓰기 오류

 

 

해결 방법

계층 구조에서 띄어쓰기 맞추기 및 ddl-auto:create → ddl-auto: create 띄어쓰기 추가

 

728x90
728x90

🌿 기본 환경: IDE: STS, Language: Java

 

 

발생 Error

Spring에서 다음 Source Code를 실행할 경우,

⭐ 하기 Error 발생

Failed to instantiate [user.service.UserUpdateService]: Constructor threw exception; nested exception is java.lang.NullPointerException

 

 

발생 원인

userDAO가 null로 선언된 상태에서 getUserList()를 실행하고자 할 때, NullPointerException 발생

 

 

해결 방법

List 선언부를 UserSelectService의 객체가 생성될 때 같이 실행되도록 하지 않고

execute() 실행될 때 생성되도록 변경하여 userDAO가 null이 아닌 값이 Setter에 주입되고 나서 값을 대입

728x90
728x90

🌿 기본 환경: IDE: STS, Language: Java

 

 

발생 Error

Spring에서 다음 Source Code를 실행할 경우,

⭐ 하기 Error 발생

nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [sample01.MessageBeanImpl]: No default constructor found;
nested exception is java.lang.NoSuchMethodException: sample01.MessageBeanImpl.<init>()

 

 

발생 원인

Class 내부에 기본 생성자를 제외한 생성자를 작성한 경우, 기본 생성자가 자동으로 생성되지 않음

기본 생성자가 만들어지지 않은 상태에서 호출되었으므로 BeanInstantiationException 발생

 

 

해결 방법

1. 기본 생성자가 자동으로 생성될 수 있도록 추가 생성자 삭제

2. 기본 생성자 추가 작성

3. 만일 1개 이상의 인자를 받는 생성자를 작성한 경우, .xml에 객체 생성 시 해당 개수만큼 Constructor 선언 필요

 

 

728x90