0

How can i restart one application hosted in Tomcat 6.0?

I'm looking for a command line command. Replace *.war file or doing this by Tomcat's http management page is not solution for for problem.

Thanks

Zé Carlos
  • 3,627
  • 5
  • 43
  • 51
  • what's wrong with a few lines of creating a copy of the war, remove the war and rename back the copy to .war? – TS- Apr 23 '12 at 15:12
  • possible duplicate of [tomcat restart webapp from command line](http://stackoverflow.com/questions/12622534/tomcat-restart-webapp-from-command-line) – Matthew Green Jul 09 '15 at 19:21

2 Answers2

3

Tomcat has no feature to graceful restart the server.

You can use the manager application and make a url call from the command line using e. g. cURL to restart a certain application.

To reload an application you can use the following command line call (using curl):

curl --user username:password http://yourserver:8080/manager/html/reload?path=/yourappname
magomi
  • 6,599
  • 5
  • 31
  • 38
  • I don't think it would work.. Management application requires authentication. And the URL you are suggesting use to restart app, includes the sessionID. So, it will only works for a few moments after login in management page.. – Zé Carlos Apr 23 '12 at 15:19
  • You are wrong. 1) Session ID doesn't matter. 2) Manager application requires basic authentication. With curl you can give username and password at command line. See my answer for the added example. – magomi Apr 23 '12 at 15:45
  • I got it with slightly changes to URL (i cut the "/html" part) Future readers can test solution using the browser with following url: http://{username}:{pass}@localhost:8080/manager/reload?path=/yourappname – Zé Carlos Apr 24 '12 at 09:57
0

There is no function but a feature. Touch the web.xml from code without really modifing it, but according to the API this is not recommended.

Stefan
  • 12,108
  • 5
  • 47
  • 66