본문 바로가기

Framework12

JPA 에러모음 1. Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: "엔티티 명" #1. 원인 Gradle 빌드에서 엔티티 클래스를 자동으로 인식을 못하는 경우 발생하는 오류이다 #2. 해결 persistence.xml에 다음과 같이 class를 추가해주면 해결이 된다. 프로젝트명.엔티티클래스 명 예시 프로젝트명.엔티티클래스 명 프로젝트명.엔티티클래스 명 옵션들 .. 2021. 8. 17.
Spring 오류 정리 4. Could not write standard input to Gradle Test Executor 5. , Java.io.IOException : 파이프가 닫히는 중입니다. #1. 원인 (Intelli J, Gradle) (로컬환경) 컴파일러가 Gradle로 되어있기 때문에 테스트 케이스 작성에 실패한 듯함 #2. 해결 Ctrl + Alt + s (환경설정) -> Build, Exception, Deployment -> Gradle -> Gradle Project 탭 Build and run using 과 Run tests using을 모두 IntelliJ IDEA 로 변경 2021. 8. 14.
Spring 오류 정리 3. javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: "엔티티 디렉토리" colu.. #1 원인 해당 엔티티 클래스 내부에서 지정한 칼럼 어노테이션에 중복이 있기 때문에, 빈 생성에 실패하면 발생하는 오류 #1 해결 해당 엔티티 클래스의 @Column 어노테이션의 name 프로퍼티의 중복이 있나 확인하여야 한다. 예제는 다음과 같다. import lombok.*; import javax.persistence.*; @Entity public class Member { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "memberId", nullable = false) private String memberId; // 에러 발생부분 Column의 name 프로퍼티가 memberId로 겹.. 2021. 8. 13.
Spring 오류 정리 2.org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'NAME' for method parameter type DATATYPE is not present ## 에러메세지 org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'NAME' for method parameter type DATATYPE is not present ## 원인 컨트롤러의 코드상에서 파라미터를 요구하였는데, 요청에 있어서 해당 필수파라미터가 결여되어있기 때문에 발생하는 에러. ## 해결방법 // 에러코드 예제 Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'name' for method parameter type Strin.. 2021. 8. 8.
Spring 공부내용 정리 : Spring Bean 과 의존관계 1. 서론 Spring 프레임워크에서 Bean과 의존관계에 대한 내용을 학습하고 정리하였다. 2. Spring Bean, 의존관계 Spring의 MVC 패턴에서, 컨트롤러는 서비스와 데이터를 주고받고, 서비스는 리포지터리와 데이터를 주고받는다. 이것을 상호 의존관계에 있다고 표현한다. Controller - Service의 의존관계 설립은 하기의 예제와 같다. // MemberController @Controller public class MemberController { @Autowired public MemberController(MemberService memberService) { this.memberService = memberService; } // Autowired라는 어노테이션을 삽입하면,.. 2021. 8. 5.
Spring 오류 정리 1. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. ## 에러메세지 ... Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. ... 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 ## 원인 Maven 기준 pom.xml에 데이터베이스를 사용하기 위한 dependency가 존재하는 경우 @SpringBootApplication 에서 .. 2021. 8. 5.