java.net.UnknownHostException: kafkaxf1: Temporary failure in name resolution
基本信息weblogic:10.3.6jdk:1.7,64位kafka:0.10.0.1zookeeper:3.4.6搭建虚拟机,部署kafka消费客户端错误信息虚拟机搭建完成后,部署应用,启动应用,报错如下<Jul 19, 2019 11:19:24 AM CST> <Critical> <WebLogicServer> &...
基本信息
weblogic:10.3.6
jdk:1.7,64位
kafka:0.10.0.1
zookeeper:3.4.6
搭建虚拟机,部署kafka消费客户端
错误信息
虚拟机搭建完成后,部署应用,启动应用,报错如下
<Jul 19, 2019 11:19:24 AM CST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine.
java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine.
at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:38)
at weblogic.server.channels.AddressUtils$AddressMaker.<clinit>(AddressUtils.java:33)
at weblogic.server.channels.AddressUtils.getIPAny(AddressUtils.java:154)
at weblogic.protocol.configuration.ChannelHelper.checkConsistency(ChannelHelper.java:61)
at weblogic.server.channels.ChannelService.start(ChannelService.java:207)
Truncated. see log file for complete stacktrace
Caused By: java.net.UnknownHostException: kafkaxf1: kafkaxf1: Temporary failure in name resolution
at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:36)
at weblogic.server.channels.AddressUtils$AddressMaker.<clinit>(AddressUtils.java:33)
at weblogic.server.channels.AddressUtils.getIPAny(AddressUtils.java:154)
at weblogic.protocol.configuration.ChannelHelper.checkConsistency(ChannelHelper.java:61)
Truncated. see log file for complete stacktrace
Caused By: java.net.UnknownHostException: kafkaxf1: Temporary failure in name resolution
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)
at java.net.InetAddress.getLocalHost(InetAddress.java:1471)
at weblogic.server.channels.AddressUtils$AddressMaker.getLocalHost(AddressUtils.java:36)
Truncated. see log file for complete stacktrace
问题原因
根据错误信息java.net.UnknownHostException: kafkaxf1: Temporary failure in name resolution,考虑是配置的机器hostname无法解析,排查如下
登录服务器,执行cat /etc/sysconfig/network,查看hostname值
执行cat /etc/hosts,查看文件信息,如图所示,hostname的值要与图中蓝色框标记的值一致,否则就会出现无法解析的问题。
说明:截图中的配置信息,与本博文中的报错信息中kafkaxf1不一致,是由于当时进行问题处理时,未截图保存,截图中的信息,是在自己的虚拟机中进行错误重现时获取的。
总结
java.net.UnknownHostException: xxx: Temporary failure in name resolution,出现该类错误,基本上都是由于部署虚拟机或从其它机器克隆机器后,未及时修改/etc/sysconfig/network及/etc/hosts两个文件的配置引起的。
如果实际使用中有上述操作,记得及时将两个配置文件修改。
更多推荐
所有评论(0)