Tech Collection

[Spring Error] 에러 모음집 본문

Build/Error

[Spring Error] 에러 모음집

eee_269 2021. 1. 16. 03:39
728x90
반응형

 

Test Code 실행 에러 - 1

> IntelliJ, Spring Boot, Gradle, JDK 11

1. 설정 바꿔주기

더보기

중간 Run tests using 을 IntelliJ로 변경!

 

2. MySQL / MariaDB 등 관계형 데이터베이스를 쓴다면

더보기
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

 

위와 같이 Repository를 설정할 때 GenerationType.IDENTITY 을 통해 id가 자동 생성되어 저장되게 설정했는데,

막상 DB 테이블의 id가 auto increment 설정이 안되어 있을 수도 있다.

 

alter table review.member modify id bigint not null auto_increment;

 

위 명령어를 통해 DB의 컬럼이 auto increment 설정이 된다면 실행이 될 것이다!

 

3. 현재 DB 테이블의 column과 같은가?

더보기

테이블의 column과 넣고자 하는 값이 들어가고 있는 key값이 같은지 확인

Test Code 실행 에러 - 2

더보기

Test 어노테이션을 봐야 함

 

import org.junit.jupiter.api.Test;

이게 아니라

import org.junit.Test;

이게 맞다!

 

 


500 Error

> STS4, Spring MVC, Maven, JDK 8

Servlet.init() ..에러가 발생하면

1. servlet-context.xml, root-context.xml, mapper, mybatis-config.xml 파일들에 적힌 경로 잘 보기

더보기

파일들이 잘 생성되었는지, 경로가 잘 설정되었는지 확인 하기

com.프로젝트이름.하위디렉토리 이렇게 내 경로가 제대로 적혀있는지 확인

 

2. pom.xml에서 버전 확인하기

더보기

groupId가 org.springframework 인 dependency들의 버전을 모두 ${org.springframework-version} 이렇게 바꾸기

-> 현재 쓰고 있는 spring 의 버전을 따라 가도록 한다.

<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring-webmvc</artifactId>
	<version>${org.springframework-version}</version>
</dependency>

 


GitHub에 연동되지 않을 때

1. GitHub에 Repository 생성 후 Project 를 commit

더보기

깃허브에 생성한 저장소가 비어있는지 확인!

-> README.md 를 먼저 만들어서 그럴 수 있다!

위 이미지와 같이 빈 저장소가 있어야 올라가진다.


Spring Test

 

 

 

 


500 Error

http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

 

 

728x90
반응형

'Build > Error' 카테고리의 다른 글

[JPA Query] Update, Delete를 쿼리문으로 짰을 때  (0) 2021.03.24
[SpringBoot Test] DataSource 에러  (0) 2021.03.21
[GitHub] push시 403 Error  (0) 2021.01.22