Was having an annoying problem where I could not shutdown a running tomcat instance.
The below is the shutdown issue I was facing:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9999; nested exception is:
java.net.BindException: Address already in use
A work-around (bad one by the way) was to just kill the catalina process:
> ps -A | grep catalina
> kill <port number>
However, I finally figured it out. Turns out switching on jmxremote (Java remote console memory monitoring) within catalina.sh was to blame. I’m not using remote monitoring anymore, so I just removed the following red entry from $CATALINA_HOME/bin/catalina.sh JAVA_OPTS line:
JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager”
Try that and see if it works!