记录一下Temporary failure in name resolution错误的解决方法

15:35:45,380 |-ERROR in ch.qos.logback.core.util.ContextUtil@62214c6f - Failed to get local hostname java.net.UnknownHostException: qtbj-dmz-122: qtbj-dmz-122: Temporary failure in name resolution
        at java.net.UnknownHostException: qtbj-dmz-122: qtbj-dmz-122: Temporary failure in name resolution
        at      at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
        at      at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:32)
        at      at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:41)
        at      at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:48)
        at      at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276)
        at      at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148)
        at      at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130)
        at      at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
        at      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147)
        at      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133)
        at      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96)
        at      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:73)
        at      at com.froad.platform.logback.LogCvt.<clinit>(LogCvt.java:92)
        at      at com.froad.platform.database.connection.impl.DBPool_DBCP.init(DBPool_DBCP.java:17)
        at      at com.froad.platform.database.connection.DBConnection.<clinit>(DBConnection.java:155)
        at      at com.qt.main.QtpayMain.main(QtpayMain.java:42)
Caused by: java.net.UnknownHostException: qtbj-dmz-122: Temporary failure in name resolution
        at      at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at      at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
        at      at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
        at      at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
        at      ... 15 common frames omitted

这个主要是/etc/hosts文件里面配置的主机名和显示的主机名不一致,改成一样就行了。

#下面这个qtbj-dmz-122就是主机名
[qtservices@qtbj-dmz-122 lib]$ 
#/etc/hosts中的主机名要和前面的一样,也需要改成一样的。
[qtservices@qtbj-dmz-122 lib]$ cat /etc/hosts
127.0.0.1   qtbj-dmz-122 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[qtservices@qtbj-dmz-122 lib]$ 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值