Can't create simple web app following IntelliJ tutorial

I'm trying to make a simple web app in IntelliJ by following this tutorial:

I am using a MAC. Steps I took:

1. Install Tomcat using Homebrew
brew install tomcat

This created /usr/local/Cellar/tomcat/7.0.42

2. Configure application server
In IntelliJ's settings -> application server, I created a Tomcat 7.0 entry with home and base directory /usr/local/Cellar/tomcat/7.0.42/libexec (that's where the /conf directory was)

3. I continue the tutorial until the part it tells me to run

, at which point I get the error:
Error: Exception thrown by the agent : Local host name unknown: nodename nor servname provided, or not known

Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:1099

This 1099 comes from the JMX port in Run -> Edit Configurations

I have tried setting this value to other values but it gives me the same error.

How do I fix this?

In case this is relevant, localhost:8080 does not work for me when I try to run in IntelliJ (I believe because of the error, it doesn't get to startup Tomcat).
However, if I run from tomcat's directory (/usr/local/Cellar/tomcat/7.0.42/libexec/bin/, I see the tomcat picture.
Comment actions Permalink

I'm not a Mac user, but this sounds like the bug  JDK-7180557 : InetAddress.getLocalHost throws UnknownHostException on java7u5 on OSX. There is also a bug report in the old  Mac OS X OpenJDK project. A comment in that bug's discussion lists a workaround.  Finally, theblog post Fixing Local host name unknown error on Mac OS X provides a simple workaround.

Comment actions Permalink

Thank you so much! The last link did it for me.


Please sign in to leave a comment.