Problem when shutting Tomcat down.

JIA Java Italian Association

Normally the reason for the java.net.ConnectException: Connection refused error while shutting down (stopping) Tomcat is caused by the fact that Tomcat server didn't start.

There are different causes for this problem, and to find the right fix you need to understand exactly what is the right cause.

One way to do this is to change how Tomcat is started. Based on the version, you can change the starting script you are using (startup.sh/startup.bat) and change the final call to tomcat.sh/.bat (Tomcat 3.x) or catalina.sh/.bat (Tomcat 4.x), using the parameter "run" instead of the parameter "start". ( if you are not using the startup.sh/.bat file, but you are unsing tomcat.sh/.bat or catalina.sh/.bat, just use the option "run" instead of "start").
This change will not spawn a new window and you will see all the errors in the same window you are working on.

Most of the times the error can be caused by:

  • JAVA_HOME is not set with the home directory of JDK you have installed
  • TOMCAT_HOME (Tomcat 3.x) or CATALINA_HOME (Tomcat 4.x) is not set with the home directory of the Tomcat version you have installed
  • environment space issues. in that case, please refer to this FAQ: "Out of environment space" when running Tomcat on Windows 98.