Tuesday, April 22, 2014

Start-Up, Shutdown or Restart the Tomcat Server Using an Ant build.xml


Following Ant build script can be used to start, stop or restart your Tomcat server. First you should set the property "tomcat.home" to your Tomcat home directory. Then when you just execute the "ant" command, it will restart your running server.
Here are all the commands you can use with this script.

Start Up:    "ant tomcat-start"
Shutdown:  "ant tomcat-stop"
Restart:      "ant" or "ant tomcat-restart"

Depending on the web application you are running, you may be getting an Out of Memory PermGen space error. If so, remove the comment marks and enable jvm argument <jvmarg value="-XX:MaxPermSize=256m"/> in the script (line 16).


11 comments:

  1. Awesome post. It most helpful for me.

    ReplyDelete
  2. Thanks... Its exactly what i needed.

    ReplyDelete
  3. Hi,

    I am able to start and stop the tomcat server but my application is not getting started which is present in tomcat webapps.

    And in tomcat GUI i can see that false is getting displayed under Running.

    please help.

    ReplyDelete
    Replies
    1. Are you sure that the application doesn't have any problem? In other word, can you start the tomcat server and run the application in normal way?

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. hai bro, its working fine bro, i want to stop the tomcat services in parallel way.

    example : i have five tomcat instances i want to stop them and stop them in a way using ant parallel can we do this?

    ReplyDelete