일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- Unsatisfied dependency
- JPA주의사항
- 스프링 부트 공식 문서
- 1차캐시
- REST란
- 최종 프로젝트
- queryDSL
- Filter
- REST API 규칙
- 스프링 부트 기능
- uncheck Exception
- jpa에러
- 복합키
- git
- github
- 인텔리제이
- Spring Spring boot 차이
- json gson 차이
- ERD 작성
- spring서버
- Error creating bean with name
- @IdClass
- 빈생성안됨
- JPA
- jwt메서드
- Q 클래스
- JoinColumn
- json
- 스프링부트오류
- jpa회원가입
- Today
- Total
Everyday Dev System
스프링부트 gradle build 오류 본문
20230610 3:40pm - 5:40pm
# 문제점 :
https://start.spring.io/에서 스프링부트 3.1.0 버전을 다운로드 하였다.
그러나, 내 로컬에서 환경변수로 저장되어 있는 JAVA_HOME의 경로는 JDK 17 버전이여서 오류가 난 경우이다.
project structure에서 JDK를 11버전으로 설정해주어야 하고, 환경변수도 11버전으로 변경하여야 한다.
Error " -- 이전 생략 --
Doesn't say anything about its elements (required them packaged as a jar)
-- 이후 생략 -- "
# 시도 :
JDK를 1.8, 11, 17 버전 모두 해보았는데 환경변수 경로를 변경해주지 않아서 계속 오류가 반복되었다.
고급 시스템 보기 - 환경변수 - Path에서 jdk 파일 내에 bin 파일 경로를 추가해줘야 한다.
# 문제 해결 :
스프링부트 3.x version은 java 17부터 이용이 가능하고,
스프링부트 2.x version은 java 8 이용이 가능하다고 한다.
그러므로 start.spring.io 에서 자바 버전에 맞는 스프링부트 버전을 선택해야 한다.
# 문제점 :
JDK 버전에 문제가 있어서 RUN이 되지 않고 있다.
Error "JDK isn't specified for module 'board.main'"
# 시도 :
1. File -> Project Structure - JDK 설정하기
아래와 같이 JDK를 설정하였는데도 오류가 사라지지 않았다.
아무래도 프로젝트에서 JDK 설정을 인식하지 못하고 있는것 같다.
이때는 Caches를 삭제하고 재시작하면 된다고 한다.
2. File -> Invalidate Caches / Restart
해당 방법을 실행해봤다. 다시 시작된 프로젝트에 JDK를 1번 방법 그대로 모두 다시 재설정 해주었다.
그리고 Main 메서드를 run 해보았다.
해결되었다. 그러나, 다른 오류가 발생했다.
오류 내용 :
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
위에 오류는 DB 연결이 되어 있지 않다는 오류이다.
spring initializr를 할 때 Dependencies에 JPA를 추가했는데, DB에 연결이 되어 있지 않아서 나오는 오류이다.
JPA를 이용하기 위해서는 DB 연결이 필수로 되어 있어야 하므로 오류가 발생하는 것이다.
이를 해결하기 위해서는 프로젝트 파일 구조에서 resources - application.properties DB 관련 정보 입력이 필요하다.
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.url= jdbc:mariadb://localhost:3308/board
url에서 port번호 뒤에는 스키마가 들어가야 한다.
제 DB 정보는 아래와 같다.
MariaDB
root Pw : 123456
port Num : 3308
DB : board
또 에러가 났다..
Error creating bean with name 'entityManagerFactory' defined in class path resource
위 오류는 DB 정보가 오타가 있을 경우 난다고 한다.. url에서 mysql이 아닌 mariadb가 맞다.
spring.datasource.url=jdbc:mysql://localhost:3308/board
spring.datasource.url=jdbc:mariadb://localhost:3308/board
실행해보니 이번에는 포트 오류가 났다.
Description:
Web server failed to start. Port 8080 was already in use.
server.port=8081
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.url=jdbc:mariadb://localhost:3308/board
포트 번호를 변경하였다. 드디어!! 성공했다.!!!
# 문제 해결 :
File -> Invalidate Caches / Restart 를 클릭하고 다시 프로젝트를 열어서 JDK를 제대로 설정해주었다.
그후에 RUN을 하니 정상적으로 잘 동작하였다.
스프링부트 공식 문서를 살펴보며 아래와 같은 내용이 있다.
Spring Boot 3.2.0 버전은 자바 17 버전을 호환한다고 한다. (20가능)
4.2. System Requirements
Spring Boot 3.2.0-SNAPSHOT requires Java 17 and is compatible up to and including Java 20. Spring Framework 6.1.0-M1 or above is also required.
references :
https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions
Spring Framework Versions
Spring Framework. Contribute to spring-projects/spring-framework development by creating an account on GitHub.
github.com
https://spring.io/projects/spring-framework#support
Spring Framework
The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuse
spring.io
'내배캠 주요 학습 > TIL : Today I Learned' 카테고리의 다른 글
스프링 오류 : Error creating bean with name 해결 (0) | 2023.06.15 |
---|---|
TIL 로컬에서 git 버전관리 파일이 이상할 때 (0) | 2023.06.12 |
0607_TIL : ClassNotFoundException 해결 (0) | 2023.06.07 |
TIL_0605 : GitHub resolve conflicts 비활성화 (0) | 2023.06.05 |
0602_TIL : ConcurrentModificationException (0) | 2023.06.02 |