Can't create simple web app following IntelliJ tutorial

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 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

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

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 startup.sh from tomcat's directory (/usr/local/Cellar/tomcat/7.0.42/libexec/bin/startup.sh, I see the tomcat picture.
2 comments

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 java.net Local host name unknown error on Mac OS X provides a simple workaround.

0

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

0

Please sign in to leave a comment.