这个问题折腾了我好几个小时,不知道是我上次配置tomcat还是配置IDEA的时候改动了什么,结果导致一个helloworld的web项目都无法启动了,始终报错Unable to ping server at localhost:1099,查了下网络上的解决方案,发现无论是更改catlina.bat文件还是修改setenv文件,都不能解决我的问题。google了一下这个问题,找到了解决的办法,这里贴上原文地址*。
问题原文如下:
I'm trying to make a simple web app in IntelliJ by following this tutorial:http://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_for_Tomcat_in_IntelliJ_IDEA_12 I believe my Tomcat is installed correctly since I see the tomcat pictures when I go to I've followed all the steps up until the part it tells me to run Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: nodename nor servname provided, or not known I see this in the log: Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:1099 答案如下: To fix this you need add your machine name in the /etc/hosts file to point to localhost(127.0.0.1).
如果你是mac用户,可以在终端中输入hostname,即可获得hostname
From the output above you know your hostname is "macbook-pro". Edit "/etc/hosts" file and add that name at the end of line that lists 127.0.0.1 既然已经知道了hostname,替换下面macbook-pro为自己的hostname,然后将下面的这段添加在host文件末尾
该方法完美解决了在mac版本的问题。 |