개발/리눅스
NoRouteToHostException 호스트로 갈 루트가 없음 해결
오류탐정
2021. 11. 25. 11:13
반응형
서버 로그에 java.net.NoRouteToHostException: 호스트로 갈 루트가 없음
라는 오류가 찍힘.
혹시 접속정보가 잘못 됬나 싶었는데 그것도 아님. 로그인 결과도 성공임 (loginCheck이 true)
FTPClient ftpClient = new FTPClient();
ftpClient.connect(String hostname, int port);
Boolean loginCheck = ftpClient.login(String username, String password)
많은 삽질끝에 어이없게 방화벽 문제였다.
https://docs.oracle.com/javase/8/docs/api/
Java Platform SE 8
docs.oracle.com
api를 뒤져보니
public class NoRouteToHostException
extends SocketException
Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.
번역 : 소켓을 원격 주소 및 포트에 연결하는 동안 오류가 발생했음을 알립니다. 일반적으로 간섭하는 방화벽 때문에 또는 중간 라우터가 다운된 경우 원격 호스트에 연결할 수 없습니다.
해결방법
방화벽 상태를 보니 켜져있다(최근에 이 서버 재기동하면서 방화벽이 자동으로 켜진듯)
# systemctl status firewalld
방화벽을 stop하고, 재부팅해도 활성화 되지 않도록 설정함.
# systemctl stop firewalld
# systemctl mask firewalld
반응형