我正在尝试按照本教程在 IntelliJ 中制作一个简单的网络应用程序: http ://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_for_Tomcat_in_IntelliJ_IDEA_12
我相信我的 Tomcat 安装正确,因为我在访问 http://localhost:8080/
时看到了 tomcat 图片
我已经执行了所有步骤,直到它告诉我运行的部分 index.jsp
,此时我收到错误:
Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: nodename nor servname provided, or not known
我在日志中看到这个:
Application Server was not connected before run configuration stop, reason:
Unable to ping server at localhost:1099
这个 1099 来自 Run -> Edit Configurations 中的 JMX 端口。
我该如何解决?
原文由 Popcorn 发布,翻译遵循 CC BY-SA 4.0 许可协议
要解决此问题,您需要在 /etc/hosts 文件中添加您的机器名称以指向 localhost(127.0.0.1)。
您可以通过运行以下命令找到您的机器名称:
从上面的输出中你知道你的主机名是“macbook-pro”。编辑“/etc/hosts”文件并在列出 127.0.0.1 的行末添加该名称
保存文件。
现在您的 IntelliJ 应该能够启动您的服务器。