회사에서, 터치바가 번쩍이는현상 문제가 생겨서 (한 1년정도 이러고살은듯..)..ㅠㅠ
노트북 교체 신청하여 새맥북을 받았다.. (여기까지는 TMI..)
당연히(?) Java JDK, HOSTS 등.. 모든 세팅이 다 초기화되어있었다. 내가 작업하던 프로젝트들도 git에서 새로 clone해와서 로컬에서 돌리려고 하는데.. 기이한 현상이 벌어졌다.
2018090003:~ we$ javac -version
javac 1.8.0_302
2018090003:~ we$ java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (Zulu 8.56.0.21-CA-macosx) (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (Zulu 8.56.0.21-CA-macosx) (build 25.302-b08, mixed mode)
우선 내가 설치한 자바 버전이다.
이상태에서 프로젝트를 구동했는데, 아래와 같은 문구가 뜨면서 실행하는데 30초나 걸리는 것이다.. (원래는 10초이내로 구동이 끝나요)
2021-10-08 11:30:40.155 WARN 28514 --- [ main] o.s.boot.StartupInfoLogger : InetAddress.getLocalHost().getHostName() took 5005 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).
그리고 log4j가 적용되어있을때는..
2021-10-08 11:32:57,148 main ERROR Recursive call to appender console
로그창에 "main ERROR Recursive call to appender console" 라는 문구가 발생하며 구동이 늦어진다..
그래서 열심히 구글링해본 결과..
InetAddress.getLocalHost() slow to run (30+ seconds)
With the following code: try { System.out.println(new Date()); InetAddress hostName = InetAddress.getLocalHost(); System.out.println(new Date()); } catch (UnknownHostException e) { e.
stackoverflow.com
java.net.InetAddress의 getLocalHost() (자바에서 호스트 네임과 IP주소를 얻기위해 호출하는 메소드)가 logging 시스템에서 호출되는 것 같은데, 이게 macOS의 fileSystem과 맞물려서 문제가 발생하는 것으로 추정된다..
- macOS Sierra, Big Sur & Java 8 (1.8.0_60.jdk, 1.8.0_77.jdk, etc) 일부 버전에서 문제가 발생한다고 나와있음. (특정 버전으로 추정되어서, 노트북 교체이전에는 문제가 발견되지 않았던 것 같다)
제시된 해결 방법중 하나로써..
sudo 권한으로 /etc/hosts에 가서
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost (PC명).local # 변경
255.255.255.255 broadcasthost
::1 localhost (PC명).local # 변경
위와같이 변경해준다. 그럼 해결된다!
= 관련문서
'Etc' 카테고리의 다른 글
Etc - OS 업그레이드 후 개발 관련 도구 에러 (xcrun: error: invalid active developer path) 해결방법 (0) | 2022.04.19 |
---|---|
Etc - 쿠키(cookie)와 세션(session) (0) | 2022.03.13 |
python 문법정리 (0) | 2021.10.20 |
Etc - Redis (0) | 2021.10.20 |