linux에서 unknownHostException이 발생한 경우 대응방법
에러내용
java.net.UnknownHostException: cl-EFSS-linux01: cl-EFSS-linux01: Name or service not known at java.net.InetAddress.getLocalHost(InetAddress.java:1473) ~[?:1.7.0_51] at com.sds.snnet.netty.ServerHandler$1.operationComplete(ServerHandler.java:71) ~[snnet-server-0.7.0.jar:0.7.0] at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:567) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:406) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.handler.ssl.SslHandler.setHandshakeSuccess(SslHandler.java:1089) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:539) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:924) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:854) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:249) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:149) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [netty-all-4.0.22.Final.jar:4.0.22.Final] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-all-4.0.22.Final.jar:4.0.22.Final] at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51] Caused by: java.net.UnknownHostException: cl-EFSS-linux01: Name or service not known |
수정방법
- /etc/hosts (Linux)
- %SystemRoot%\system32\drivers\etc\hosts (Windows)
linux
$ vi /etc/hosts
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 127.0.0.1 cl-EFSS-linux16 <-추가 ::1 localhost6.localdomain6 localhost6 ~ |