Showing posts with label jenkins. Show all posts
Showing posts with label jenkins. Show all posts

Sunday, February 16, 2014

Resolving UnknownHostException right after installing Jenkins

I've just installed Jenkins on my CentOS 6.4 using the very instructions provided on Jenkins website:
Installing Jenkins on RedHat distributions

After the installation, even though Jenkins was up, I was getting the following exception on logs:

WARNING: Could not intialize the host network interface on nullbecause of an error: centos64: centos64: Name or service not known
java.net.UnknownHostException: centos64: centos64: Name or service not known
    at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
    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:32)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.net.UnknownHostException: centos64: Name or service not known
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
    at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
    ... 8 more

Now I don't have the slightest clue about why was jenkins trying to resolve to a server called centos64, but adding that entry to my /etc/hosts file resolved the problem:

127.0.0.1   localhost centos64

It guess it must have used some default configuration and got that network hostname that didn't exist.