반응형

Java Spring boot 8

HttpClientErrorException HttpServerErrorException 예외 메세지 처리

여러 블로그 찾아봤는데 exception을 처리할 수 있는 클래스까지 만들어서 처리하는 방법만 가이드 하고 있었다. 신규 프로젝트야 클래스 만들어서 하면 되는데레거시 시스템에서 클래스를 만들어 처리하기엔 영향도가 부담됐다. 가장 간단하게 예외를 처리할 수 있는 방법을 정리해둔다try {} catch(HttpClientErrorException hex) { String statusCode = hex.getStatusCode().toString(); String responseBody = hex.getResponseBodyAsString();} catch(HttpServerErrorException hex) { String statusCode = hex.getStatusCode().toString();..

Java Spring boot 2025.03.24

ProcessException / ProcessMessageException

try{throw processException(message);} catch (ServiceException ex) { System.out.println(ex.getMessageKey());// processException의 메세지를 받고 싶다면 ServiceException으로 받아야함// messagekey에 exception 발생 시 입력했던 메세지가 들어있음// Exception 로 캐치하면 메세지를 뽑아내기 어려움…}try{throw processMessageException(message);} catch (Exception ex) {System.out.println(ex.getMessage());// Exception으로 메세지를 받고 싶다면 processMessageException을 사..

Java Spring boot 2025.03.19

Error Mybatis Mapped Statements collection does not contain value for

이 에러의 원인은 다 비슷하게 이렇게 알려준다.1. Mapper id가 다른 경우2. Parameter와 bean의 필드명이 다른 경우3. Mapper파일과 XML파일의 네임스페이스가 다른 경우 (Mapper파일: *context.xml파일)3. Mapper파일에 정의된 namespace 명칭이 중복될 경우4. sql.xml에 정의된 경로와 DAO에서 호출하는 경로가 다른 경우 (context.xml 파일에 정의된 sql.xml파일)파일을 새로만드는 경우에는 Mapper 파일을 확인해보는게 좋다.sql.xml 파일도 확인해본다.그러나 기존 파일에 추가만하는 경우에는 대부분 오탈자다id만이 아니라 parameterType, returnType 의 대소문자까지 전부 확인해야한다.대소문자 오류 못잡아주는 자바..

Java Spring boot 2024.12.04

java convert timestamp to datetime

timestamp 와 datetime 시간 비교 이런 간단한 비교가 간단히 되지 않아서 내 식대로 만들었다. timestamp와 datetime 둘다 날짜 관련 변수인데 비교가 어려운 게 이해가 안간다... 씨샵 개발자였어서 인지 간단하게 작성할 수 있는 방식이 좋더라. * 변수는 왠만하면 약자 대신 풀네임으로 쓰자. 받아들이는 사람마다 다르게 받아들 일 수 있다. e.g. bef > before DateTime before = DateTime.now().minusMinutes(10); //비교하려는 시간: 현재시간 -10분전 Timestamp updateDate = map.getUpdateDate(); //이 변수가 timestamp boolean check = updateDate.before(Time..

Java Spring boot 2024.08.15

[Error][Tomcat]

[Error][Tomcat] The origin server did not find a current representation for the target resource or is not willing to disclose that one exists https://mondaymonday2.tistory.com/529 [Error][Tomcat] The origin server did not find a current representation for the target resource or is not willing to disclose th 이 문제의 원인은 tomcat에서 호출한 경로를 제대로 인식하지 못해서 발생한다고 합니다. Servers 탭 톰캣 더블클릭해서 열어주시고 Modules를 눌러주..

Java Spring boot 2023.03.07

Eclipse IDE 설치 ver.2021

Eclipse IDE for Java Developers 설치 zip 파일 Eclipse에서 설치파일을 exe로 제공하여 앱 내 링크로 설치할 수 있도록 제공합니다. 간혹 보안문제로 사내에서 설치할 수 없는 문제가 발생합니다. zip파일로 직접 설치할 수 있는 경로 안내해드립니다. 1. Eclipse IDE for Java Developers 설치경로 https://www.eclipse.org/downloads/packages/release/2020-12/r/eclipse-ide-java-developers Eclipse IDE for Java Developers | Eclipse Packages Package Description The essential tools for any Java develop..

Java Spring boot 2021.07.01
반응형