背景
在使用WAR包安装jenkins后,启动tomcat,显示启动成功,但最后提示信息如下:
04-Dec-2018 03:28:21.563 WARNING [Computer.threadPoolForRemoting [#1]] javax.jmdns.impl.HostInfo.newHostInfo Could not intialize the host network interface on nullbecause of an error: jenkins: jenkins: System error
java.net.UnknownHostException: jenkins: jenkins: System error
at java.net.InetAddress.getLocalHost(InetAddress.java:1506)
at javax.jmdns.impl.HostInfo.newHostInfo(HostInfo.java:75)
at javax.jmdns.impl.JmDNSImpl.<init>(JmDNSImpl.java:407)
at javax.jmdns.JmDNS.create(JmDNS.java:60)
at hudson.DNSMultiCast$1.call(DNSMultiCast.java:33)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.UnknownHostException: jenkins: System error
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
at java.net.InetAddress.getLocalHost(InetAddress.java:1501)
... 10 more
通过警告信息中提取到信息是 主机名不能解析
[root@jenkins opt]# hostname
jenkins
[root@jenkins opt]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:c1:50:9f brd ff:ff:ff:ff:ff:ff
inet 172.20.0.50/24 brd 172.20.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fec1:509f/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:0c:29:c1:50:a9 brd ff:ff:ff:ff:ff:ff
[root@jenkins opt]# echo '172.20.0.50 jenkins' >> /etc/hosts
[root@jenkins opt]# tail -1 /etc/hosts
172.20.0.50 jenkins
[root@jenkins opt]# ping jenkins
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.087 ms
^C
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.087/0.087/0.087/0.000 ms
手动添加解析,重启tomcat后警告消失;