[JAVA] unable to find valid certification path to requested target (해결완료)

728x90

 

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

 

연결하려는 사이트의 인증서가 jvm의 신뢰하는 인증서 목록에 없어서 발생하는 문제.

 

만약 별도의 사내 보안장치가 없다면 아래 블로그를 따라하면 된다.

[ERROR] unable to find valid certification path to requested target (tistory.com)

 

[ERROR] unable to find valid certification path to requested target

https://~~~.co.kr/~~ API 호출해서 체크하고 응답값에 따라 구분해주세요~ 외부 API 호출해서 처리할 이슈가 생겼다. 원래는 브라우저에서 처리하려고 했으나, 외부업체에서 "CORS 정책을 풀어줄 수 없

cherry-beer.tistory.com

 

나 같은 경우 별도의 사내 보안장치가 있어서 저렇게 할 수가 없었다.
선배님께 여쭤보니 타고 타고 타고..파트장님까지 흘러가서 인증서 파일을 받을 수 있었다.

 

 

C:\Program Files\Java\jdk1.8.0_191\jre\lib\security

인증서 파일은 자바 jdk가 설치된 경로 (환경변수 path에 등록 된 주소) 로 들어가서 security 파일에 인증서 파일을 넣어준다.

 

이후 cmd창을 켜서 

 

keytool.exe -import -alias shiwsmart -keystore "C:\Program Files\Java\jdk1.8.0_191\jre\lib\security\cacerts" -storepass changeit -file "C:\Program Files\Java\jdk1.8.0_191\jre\lib\security\인증서파일"

 

을 넣어주면된다.

실행 어쩌구? 물어보면 y 엔터

성공하면 성공했다고 딱 한 줄만 뜬다.

 

 

 

 

728x90