반응형

TroubleShooting 16

Kotlin: Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

문제 기존에 진행하던 프로젝트에 메모리 문제가 있어 지우고 새로 받아 테스트 코드를 돌렸는데 에러 발생 Kotlin: Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option 원인 JVM 11로 컴파일했는데 1.8로 컴파일을 하면 안된다!! 원인은 intellij 설정에서 JVM 11 로 설정이 되있지 않아서 해당 문제가 발생하였습니다. 해결 Project Structure 진입 방법: file > project Structure 1. project 에서 sdk 설정을 버전에 맞게 설정합니다. 2. Mo..

TroubleShooting 2021.07.05

Unrecognized field "address" (class me.kotlin.sample.sample.SimpleData), not marked as ignorable (2 known properties: "first_name", "last_name"]) at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: me.kotlin.sample.sample.SimpleData["ad..

ObjectMapper를 사용하던 중 에러 발생! 증상 에러 메시지 Unrecognized field "address" (class me.kotlin.sample.sample.SimpleData), not marked as ignorable (2 known properties: "first_name", "last_name"]) at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: me.kotlin.sample.sample.SimpleData["address"]) OtherData 데이터 객체를 SimpleData 데이터 객체로 바꾸는 중 에러 발생 class OtherData( val lastName: String? = null, va..

TroubleShooting 2021.05.12

nested exception is java.lang.IllegalArgumentException: No sources given

오늘도 어김없이 발생하는 Exception!! 증상 Querydsl-JPA를 사용중 에러가 발생했습니다. 에러를 보면 IllegalArgumentException 입니다. 쿼리를 생성할 때 잘못하면 보통 이 에러가 발생합니다. 그리고 No Sources Given.. 번역기를 돌려면 출저가 없다는 에러?? nested exception is java.lang.IllegalArgumentException: No sources given public StaffVo search(Long id) { return jpaQueryFactory .select(Projections.fields(StaffVo.class, staff.id, staff.name )) .where(staff.id.eq(id)) .fetchO..

TroubleShooting 2020.12.19

[JPA] java.lang.NoSuchMethodException: org.springframework.data.domain.Pageable.<init>

오늘도 어김없이 Exception 발생했네요! 요즘은 Exception이 발생하면 어떻게 풀어서 블로그를 작성할까하고 Exception을 기다리고 있습니다 :) 증상 오늘 발생한 에러는 Querydsl에 Paging 처리가 필요하여 Pageable을 사용했을 때 발생하는 에러였습니다. 아래와 같은 코드를 작성하여 Parameter로 Pageable 객체를 받는 부분에서 에러가 발생하였습니다. @RestController @RequiredArgsConstructor// DI public class StoreController { private final StoreService storeService; @GetMapping(value = "/stores/{storeId}") pubic DefaultRespo..

TroubleShooting 2020.12.11

[prometheus] org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver

Prometheus를 띄워봤으니 프로젝트에 적용해보자! 하던 중에 Exception이 어김없이 발생했습니다. 정말 고마운 분의 글을 참조해서 문제를 해결하였습니다. 증상 application에 actuator, prometheus 디펜던시를 추가하고 Security Endpoint도 적용하고 다 했는데 안되었습니다. actuator, health, info, metrics 는 다 되는데 prometheus만 안되는 현상이었습니다. 증상으로는 에러도 아니고 WARN 이네요 아래와 같습니다. WARN org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver [AbstractHandlerExceptionResolver.java:19..

TroubleShooting 2020.12.08

org.springframework.dao.InvalidDataAccessApiUsageException

오늘도 어김없이 등장하는 Exception!! org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query 증상 Querydsl로 Update, Delete하던 중 에러가 발생하였습니다. 에러가 발생한 코드는 다음과 같습니다. public Long deleteQuery(Long id) { // JpaQueryFactory 사용 시 // return jpaQueryFactory.delete(store) // .where(s..

TroubleShooting 2020.12.05

[junit] Auditor must not be null! Returned by: class com.example.demo.db.LoginUserAuditorAware!

Junit 테스트 코드를 작성하는 도중 Auditor must not be null 에러가 발생하였습니다. 증상 Junit 테스트 할 로직 중 SecurityContext 정보를 조회할 필요가 있었습니다. 그래서 @BeforeEach 메서드에서 SecurityContext를 Mock으로 임의의 데이터를 넣고 @Test를 실행하는 경우였습니다. @BeforeEach void setUp() { // SecurityContext에서 가져올 유저 정보 UserVo userVo = new UserVo(); userVo.setUserId(1L); List roleNames = Arrays.asList("ROLE_ADMIN"); // userDetails Mock 설정 UserDetails userDetails = ..

TroubleShooting 2020.12.04

[intellij] No candidates found for method call ""

가끔 intellij build.gradle 파일에서 No candidates found for method call "" 에러가 뜰 때가 있습니다. 정확한 원인은 파악하지 못하고 해결을 해버렸습니다. 제 생각으로는 설정값이 꼬여서 발생한 문제 같아보였습니다. ( 정확하지 않습니다. ㅠ ) 해결 방법 Command + Shift + A 을 누릅니다. reload를 검색한 후 Reload All Gradle, sbt, BSP Projects 를 클릭해주세요. 그럼 정상적으로 돌아옵니다!

TroubleShooting 2020.11.22

[intellij] module not specified

한참 잘하고 있던 프로젝트의 명과 workspace 폴더명을 바꾸고 나서부터 실행이 안되는 현상입니다. 에러는 Module not specified 이었습니다. 여기서 아래의 그림을 보시면 Module을 찾을 수 없다는 문구를 볼 수 있습니다. no module로 표기된 셀렉트 박스를 클릭하여 선택하면 정상적으로 실행됩니다. workspace 폴더명을 바꾸면서 module 경로를 잃어버려서 생긴 문제였습니다!

TroubleShooting 2020.11.10

java jar 배포 시 파일을 찾을 수 없습니다. [해결방법]

Spring boot는 내장 톰캣이 있기 때문에 jar배포를 하면 내부적으로 톰캣을 띄울 수 있습니다. 그런데 배포하자마자 resource에서 excel file 읽어올 때 에러가 났습니다. fileNotfound!!! 문제되는 소스는 아래와 같습니다. File file = ResourceUtils.getFile("classpath:" + filePath); Local에서는 정상작동하는데 왜 안되는가 하고 여러가지 시도를 했습니다. URL은 잘 가져오나? URL url = ResourceUtils.getURL("classpath:"+filePath); 결과는 url=jar:file:/home/yongtae/server/test-project-0.0.1-SNAPSHOT.jar!/BOOT-INF/classe..

TroubleShooting 2020.11.09

Class com.querydsl.core.types.QBean can not access a member of class "entity" with modifiers "protected"

JPA, Querydsl을 학습하는 도중 com.querydsl.core.types.QBean com.example.queyrdsl.entity.Staff with modifiers "protected" 라는 Exception이 발생했다. querydsl 사용중 QBean에서 Entity객체인 Staff를 생성하려한다. 하지만 Staff 클래스는 Access = Protected였다. 그래서 위와같은 에러가 발생하였다. @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED)// 이 부분이 문제 public class Staff { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) privat..

TroubleShooting 2020.11.06

Multiple representations of the same entity [com.example.queyrdsl.entity.Staff#2] are being merged

JPA 정리 도중 에러 발생! Repository를 이용하여 save할 시 발생했던 에러다. 원인은 간단하다. @OneToMany 관계에서 Many에 해당하는 Entity를 save할때 문제가 발생했다. Entity는 고유하다! 하지만 난 2개의 Entity @Id 컬럼에 같은 값을 넣고 save하는 중이었다. JPA가 같은 Entity가 들어왔으니 위와 같은 에러를 보여준 것이다. 해결은 @Id 컬럼의 값을 수정했다.

TroubleShooting 2020.11.06

JPA Cannot resolve table, JPA Cannot resolve column

JPA Entity 작성 중 Intellij에서 에러 밑줄이 쳐진다. intellij에서 사용하는 database와 연동하여 작성한 컬럼이 존재하는지 체크하는 과정 중 에러가 발생하는 것이다. 해결 방안 인텔리제이에서 datasource 설정되어있는지 체크 인텔리제이 DataSource 할당되어있는지 체크 View > Tool windows > Persistence 클릭 나타나는 항목을 마우스 우클릭하여 Assign Data Sources 클릭 Data Source 할당

TroubleShooting 2020.11.05
728x90
반응형