전체 글

백엔드 개발자 취준생입니다:)
Java/오류 해결

[Java 오류] java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long, class java.util.ArrayList cannot be cast to class java.time.LocalDateTime

1. 문제 상황 // claim 정보 -> Member 로 변환 public static Member fromJwtClaims(Map jwtClaims) { // 오류 발생 코드1 long id = (Long) jwtClaims.get("id"); // 오류 발생 코드2 LocalDateTime createDate = (LocalDateTime) jwtClaims.get("createDate"); LocalDateTime modifyDate = (LocalDateTime) jwtClaims.get("modifyDate"); // 끝 String username = (String) jwtClaims.get("username"); String email = (String) jwtClaims.get("emai..

인프라/오류 해결

[리눅스 오류] bash: /usr/local/bin/helm: 이진 파일을 실행할 수 없음: Exec 형식 오류 (cannot execute binary file: exec format error)

1. 문제 상황 Helm 압축 파일을 다운로드 받고 설치 후, helm 실행을 하려고 하니 이진 파일을 실행할 수 없다는 오류가 떴다. yum install wget -y mkdir ~/tmp cd ~/tmp wget https://get.helm.sh/helm-v3.10.0-linux-amd64.tar.gz tar zxvf helm-v3.10.0-linux-amd64.tar.gz mv linux-amd64/helm /usr/local/bin/helm cd / rm -rf ~/tmp # 오류 발생 지점 helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx 보통 이러한 오류가 나는 원인은 아래와 같다. 1) 다운을 받은 tar.gz ..

Spring/Spring 학습

[Spring Security] CSRF /logout 설정

1. CSRF 토큰 사용할 때 1) 스프링 시큐리티 설정 Java 코드 @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @RequiredArgsConstructor public class SecurityConfig { private final AuthenticationSuccessHandler authenticationSuccessHandler; private final AuthenticationFailureHandler authenticationFailureHandler; @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws E..

Spring/오류 해결

[Spring 오류] TemplateInputException, SpelEvaluationException: EL1008E Property or field 'profileImgRedirectUrl' cannot be found on object of type 'org.springframework.security.core.userdetails.User' - maybe not public or not valid?

1. 문제 상황 - 가짜 user1 객체로 로그인 설정을 했을 때 오류가 발생했다. @Test @DisplayName("user1로 로그인 후 프로필페이지에 접속하면 user1의 이메일이 보여야 한다.") void t3() throws Exception { // WHEN // GET / ResultActions resultActions = mvc .perform( get("/member/profile") .with(user("user1").password("1234").roles("user")) ) .andDo(print()); // THEN // 안녕 resultActions .andExpect(status().is2xxSuccessful()) .andExpect(handler().handlerType..

Spring/오류 해결

[Spring 오류] Mac 파일 업로드 경로 오류 - java.io.FileNotFoundException

application.yml 파일에서 업로드한 파일을 저장할 디렉토리 위치를 아래와 같이 설정했다. custom: genFileDirPath: Desktop/temp/app10 1. mac에서 디렉토리를 생성하기 2. 생성한 디렉토리 경로를 복사해 genFileDirPath 에 붙여넣기 - 2가지 방식이 있다(root 는 /Users/로 설정해주면 된다!!) 1) 해당 디렉토리로 이동 > 하단 디렉토리 우클릭 > 경로 이름 복사 2) cmd + i (파일 정보) > 위치 우클릭 > 경로 이름으로 복사 3. application.yml 파일의 custom.genFileDirPath 경로 수정 custom: # 업로드 파일 저장 경로 genFileDirPath: /Users/hanseung-yeon/temp..

Spring/오류 해결

[Spring 오류] Spring Boot - 파일 업로드 용량제한 설정 - org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException

error log 내용대로 업로드할 수 있는 최대 용량을 넘긴 파일을 업로드 하려고 할 때 발생하는 에러다. 따로 설정하지 않았다면 default값이 1048576 bytes 로 약 1MB이다. application.yml 설정파일에 파일 업로드 용량 제한 설정하기 spring: servlet: multipart: max-file-size: 10MB max-request-size: 10MB

DB/오류 해결

mysql 무한 로딩 : can't connect to local mysql server through socket '/var/lib/mysql/mysql.sock' (2)

sudo vim /etc/my.cnf.d/mariadb-server.cnf sudo systemctl restart mariadb mysql 한글 깨짐 문제를 해결하기 위해 /etc/my.cnf.d/mariadb-server.cnf 파일 수정 후 restart 하려고 하니 mysql이 무한로딩에 빠졌다. CentOs 재부팅: sudo shutdown now -> ssh 계정명@CentOsIP

Spring/오류 해결

[Spring 오류] Error creating bean with name 'requestMappingHandlerMapping'

컨트롤러의 @RequestMapping 으로 설정된 경로 중 특정 맵핑 경로가 중복되어 발생한 오류 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateExcepti..

HSY_mumu
mumu 개발 블로그