IntelliJ,无法启动简单的 Web 应用程序:无法在 localhost:1099 上 ping 服务器 [英] IntelliJ, can't start simple web application: Unable to ping server at localhost:1099
问题描述
我正在尝试按照本教程在 IntelliJ 中制作一个简单的 Web 应用程序:http://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_for_Tomcat_in_IntelliJ_IDEA_12
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
我相信我的 Tomcat 安装正确,因为我在去的时候看到了 tomcat 图片http://localhost:8080/
I believe my Tomcat is installed correctly since I see the tomcat pictures when I go to
http://localhost:8080/
我已按照所有步骤进行操作,直到它告诉我运行 index.jsp
的部分,此时我收到错误消息:
I've followed all the steps up until the part it tells me to run index.jsp
, at which point I get the error:
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
这个 1099 来自 Run -> Edit Configurations 中的 JMX 端口.
This 1099 comes from the JMX port in Run -> Edit Configurations.
我该如何解决这个问题?
How do I fix this?
推荐答案
要解决此问题,您需要在/etc/hosts 文件中添加您的机器名称以指向 localhost(127.0.0.1).
To fix this you need add your machine name in the /etc/hosts file to point to localhost(127.0.0.1).
您可以通过运行以下命令找到您的机器名称:
You can find your machine name by running the following command:
$ hostname
macbook-pro
从上面的输出你知道你的主机名是macbook-pro".编辑/etc/hosts"文件并在列出 127.0.0.1 的行的末尾添加该名称
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
127.0.0.1 localhost macbook-pro
保存文件.
现在您的 IntelliJ 应该可以启动您的服务器了.
Now you IntelliJ should be able to start your server.
这篇关于IntelliJ,无法启动简单的 Web 应用程序:无法在 localhost:1099 上 ping 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!