Tomcat in Idea. war exploded: Server is not connected. Deploy is not available

The issue happens when a script in the tomcat startup set of scripts (most commonly setenv.sh / setenv.bat) override the JAVA_OPTS environment variable without including the original value. IDEA sets JAVA_OPTS to tell tomcat to listen on 1099 for JMX requests for things like status and deployments.

An example of a line from a setenv.sh that will break:

export JAVA_OPTS="-XX:MaxPermSize=512m -Xmx1024m"

the corrected version:

export JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=512m -Xmx1024m"

The same example lines from a windows setenv.bat file:

set JAVA_OPTS=-XX:MaxPermSize=512m -Xmx1024m

and corrected:

set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=512m -Xmx1024m

If you only run tomcat from within IDEA, you can do as other have suggested and remove the line from your setenv script and put the jvm options inside the IDEA run configuration.

Leave a Comment