개인기록 26

[오류/해결] Public Key Retrieval is not allowed

에러 메세지 원인 MySQL 8.0이상 버전에서 jdbc-url 설정을 useSSL=false로 설정하고 allowPublicKeyRetrieval 설정을 하지 않은 경우에 발생한다 -> jdbc-url에서 useSSL=false로 지정해놓고 따로 설정을 하지 않음을 확인할 수 있었다 해결 application.proeprties에서 jdbc-url을 수정한다 spring.datasource.jdbc-url=jdbc: mysql://localhost:3306/DB명?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=UTC allowPublicKeyRetrieval 설정 인텔리제이 사용시 Database > Pr..

개인기록 2022.11.13

[오류/해결] Property [name] not found on type [dto(혹은 vo)]

오류가 2개 발생하여 정리하였다. 제목의 오류는 오류 2에 해당한다 환경 java 8, mybatis, spring boot, maven project 오류 1 Result Maps collection does not contain value MyBatis mapper 설정시 resultMap과 resultType값을 잘못 설정하게 되면 발생하는 문제이다 select * from coffee_product resultType이 아닌 resultMap으로 설정되어있다 해결 select * from coffee_product 오류2 Property [pName] not found on type [ProductDto] ProductDto에서 pName을 찾을 수 없다는 것으로 추정된다 상품 리스트를 db에서 ..

개인기록 2022.11.08

[오류/해결] spring boot mybatis insert가 안되는 오류

환경 java 8, mybatis, spring boot, maven project 개요 테스트는 통과하는데 정작 DB에 데이터가 추가가 안되는 오류가 있었다 콘솔로 insert를 하면 auto increment로 설정한 Id값이 올라갔기 때문에 어떤 설정이 잘못된건지 찾기가 어려웠다 해결 테스트 어노테이션을 바꾸니 제대로 데이터가 추가되었다 변경 전 @MybatisTest @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) class AdminMapperTest { @Autowired private AdminMapper mapper; @Test @DisplayName("insert 테스트") void productEn..

개인기록 2022.11.05

[오류/해결] spring boot에서 mybatis 테스트하기

사용 기술 java 8, spring boot, mybatis, mysql, maven project junit5 test 개요 Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class] 오류가 발생하였다 원인 (추정) 1. Junit Test에서 DB를 못찾았다 2. application.properties 경로에 이상이 있다 3. spring boot 생성시 만들어지는 Application 클래스에서 DataSourceAutoConfiguration를 exclude로 설정했다 원인을 토대로 ..

개인기록 2022.10.30

[해결] jsp에서 css, js 경로를 못 찾는 문제

환경 : java 11, Spring maven project [개요] webapp - resources - css - menu.css 파일을 index.jsp에서 읽지 못하는 문제가 생겼다 검색 키워드 : jsp css 적용 안됨 찾아본 해결법 1. 캐시 문제 캐시 문제인 경우 ctrl + F5를 눌러 새로고침을 하면 캐시가 삭제되어 css가 제대로 보인다고 한다 1-1. 캐시문제 2 css를 수정한 경우 이전 css가 실행될 수 있다 이 경우 경로 뒤에 쿼리스트링으로 버전을 붙여서 해결할 수 있다 ?ver=숫자 ?version=숫자 예시 -> 위의 방법은 css뿐만 아니라 js 문제에도 적용할 수 있다 2. servlet-mapping 지정하기 default *.js *.css *.jpg *.gif ..

개인기록 2022.09.23

[기록] WARNING: An illegal reflective access operation has occurred

환경 : jdk 11, springframework 5.0.2 [로그] WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1 WARNING: Use --illegal access=warn to enable warnings of further illegal reflective access operations WAR..

개인기록 2022.09.09

[기록] 인텔리제이 프로젝트 UTF-8 설정

[개요] 테스트를 하던 중 properties 파일의 인코딩이 UTF-8이 아닌 기본 설정으로 되어있어 한글이 일치하지 않아 통과를 못하는 오류가 발생했다 [해결] 인텔리제이 인코딩 타입 변경 Settings > Editor > File Encodings > Global Encoding Project Encoding Properties Files 전부 UTF-8로 변경 후 ok를 눌러준다 "Tranparent native-to-ascii conversion" 을 설정해 주면 자동으로 변환되서 표시가 된다 [적용된 모습] VM 옵션으로 설정하기 Help -> Edit Custom VM options -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8 을 입력 "-"도 포함하..

개인기록 2022.09.05

[오류/해결] jsp에서 db로 insert시 한글 깨짐 현상(오라클)

환경 : java 11, oracle 11g enterprise 직전에 한 프로젝트 파일에서는 한글로 추가 되었으나, 갑자기 글자가 깨지는 인코딩 오류가 발생하였다 WEB-INF -> web.xml에 아래의 코드를 추가해주면 된다 SetCharEncoding org.apache.catalina.filters.SetCharacterEncodingFilter encoding utf-8 SetCharEncoding /* 입력한 후 저장(ctrl + s)을 해준 후 다시 실행하면 한글로 추가된 것을 확인 가능하다

개인기록 2022.08.26

[오류/해결] sequence 번호 증가(1 -> 21 -> 41) | Oracle

개요 게시판 실습을 하면서 오라클 DB와 연결하여 insert를 하는데 게시물 번호가 이상하게 증가되었다 분명히 시퀀스 설정을 할 때 create sequence 시퀀스이름 increment by 1 start with 1; 로 설정을 했는데 예시 : create sequence movie_seq increment by 1 start with 1; 서버를 껐다 키니 번호가 임의로 늘어났다 이유를 찾아보니 기본 시퀀스 설정인 cache 옵션으로 인해 시퀀스 메모리가 20단위로 할당되어 있었고, 그 단위를 채우지 않고 DB 연결을 끊으면 할당된 메모리 이후의 번호인 21번부터 시작하게된다는 것이다 해결법 cache 설정을 끄면 된다 alter sequence 시퀀스이름 nocache; 예시 : alter s..

개인기록 2022.08.22