解決 搭建Jekins過程中 啟動Tomcat的java.net.UnknownHostException異常


11-Nov-2016 06:01:33.229 WARNING [Computer.threadPoolForRemoting [#1]] null.null Could not intialize the host network interface on nullbecause of an error: myserver: myserver: unknown error
 java.net.UnknownHostException: myserver: myserver: unknown error
    at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
    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 java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: myserver: unknown error
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
    ... 9 more

在Linux Tomcat下啟動Jekins的時候報以上的錯誤,究其原因是因為服務器配置了自定義的host name 沒有在hosts文件中定義.

解決方法如下:

1. 查看自己服務器的host name

# hostname

2. 進入etc/hosts 編輯,在下面加一行:

  127.0.0.1  你的hostname

3. 保存退出,重啟tomcat.解決

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM