Spring boot 에서 selenium 라이브러리 디펜던시 Exception

이미지
Slack Bot을 만들어 볼까 해서 집에 있는 나스에 spring boot로 올리려고 했다. 그래서 좋은 웹 크롤러 라이브러리가 뭐가 있나 찾아보다가 selenium이라고 아주 깔쌈한 걸 찾아서 사용해보려고 했다가 알 수 없는 예외 때문에 하루를 그냥 날려버렸다. 일단 Gradle dependencies에 추가 compile group : 'org.seleniumhq.selenium' , name : 'selenium-java' , version : '3.141.59' 일단 selenium을 쓰려면 WebDriver를 사용한다. WebDriver도 브라우저마다 다양하게 지원된다. FireFox, Chrome, Opera, IE, Edge, Safari 이렇게 지원해주나? 그 중에서도 나는 Chrome driver를 사용하려고 했다. http://chromedriver.chromium.org/downloads 여기서 driver를 다운 받는데, 제일 중요한 점! 본인 컴터에 깔린 크롬 버전에 맞게 다운받아야된다. 아니면  java.lang.IllegalAccessError: tried to access class org.openqa.selenium.os.ExecutableFinder  예외를 맞닥뜨리게 된다. 혹은 아래에 나오는 경로를 잘못 잡아줘도 같은 예외를 맞닥뜨린다. 내가 다운로드 한 버전은 74 Driver 객체 생성하기 전에 아래 처럼 다운 받은 chromedriver 경로를  system property에 잡아줘야된다. 여기까지는 금방금방 진행이 되었다. System. setProperty ( "webdriver.chrome.driver" , "/Users/namdong-gil/Downloads/chromedriver" ) ; WebDriver driver = new ChromeDriver() ; 하지만 아래에...

Spring javax.mail 사용 시 javax.mail.AuthenticationFailedException 발생 해결

이미지
분명히 내가 username 이랑 password가 맞는데 javax.mail.AuthenticationFailedException 발생 한다면, 아래로 들어가서 해당 계정을 허용 해줘라 https://www.google.com/settings/security/lesssecureapps

HackerRank Java New Year Chaos

이미지
문제풀기 :  https://www.hackerrank.com/challenges/new-year-chaos/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays&h_r=next-challenge&h_v=zen It's New Year's Day and everyone's in line for the Wonderland rollercoaster ride! There are a number of people queued up, and each person wears a sticker indicating their   initial   position in the queue. Initial positions increment by     from     at the front of the line to     at the back. Any person in the queue can bribe the person   directly in front   of them to swap positions. If two people swap positions, they still wear the same sticker denoting their original places in line. One person can bribe   at most two others . For example, if     and     bribes   , the queue will look like this:   . Fascinated by this chaotic queue, you decide you must know the minimum number of bribes th...