1. 程式人生 > >java.net.MalformedURLException: Local host name unknown報錯處理

java.net.MalformedURLException: Local host name unknown報錯處理

linux 修改host後啟動tomcat報錯
錯誤: 代理丟擲異常錯誤: java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: centos4: centos4: 未知的名稱或服務
Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: centos4: centos4: Name or service not known
原因是/etc/hosts檔案裡沒有主機名為:centos4,解決方法就是在hosts檔案中加入centos4,修改後的hosts的檔案是:

127.0.0.1  centos4 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6