1

I'm using Tomcat Web Application Manager to reload a Tomcat application after I recompile the java servlet file, is there a way to reload the app using command line?

Cœur
  • 37,241
  • 25
  • 195
  • 267
jcubic
  • 61,973
  • 54
  • 229
  • 402
  • Just copy the new war file to the webapps folder, and Tomcat will redeploy it. – JB Nizet Dec 01 '13 at 13:07
  • And if you need to reload without a change, I believe touching the file will cause a redeploy. – chrylis -cautiouslyoptimistic- Dec 01 '13 at 13:09
  • @JBNizet I change the file compile it and it serve the old one. – jcubic Dec 01 '13 at 13:17
  • I advise you to copy the new war file to webapps. Then you tell me that just recompiling the file doesn't work. Where's the logic? How about doing what I advised: rebuild the war file and copy this new war file to webapps? – JB Nizet Dec 01 '13 at 13:20
  • Possible duplicate of [tomcat restart webapp from command line](https://stackoverflow.com/questions/12622534/tomcat-restart-webapp-from-command-line) – Petr Bodnár Jul 03 '18 at 09:35

1 Answers1

4

I can think of a variety of ways to do this from the command line:

  1. Copy the new WAR file to the webapps folder, or just touch it.

  2. Use wget or curl to send the appropriate HTTP requests to the server's web management interface.

  3. Use the "catalina.sh" script ... if you haven't installed tomcat as a service.

  4. Run "/etc/init.d/tomcat restart" ... or however you restart a service on your system.


Note: I (too) have had difficulties in the past getting WAR file redeployment to work. When I'm doing Tomcat development, I tend to go for a full restart rather than redeploying individual servlets / WAR files.


What is WAR file?

Read this: http://en.wikipedia.org/wiki/WAR_file_format_%28Sun%29

I have a project symlink in /var/lib/tomcat7/webapps/app to my app directory and that's it and it work.

Bad idea, for a variety of reasons. But if you insist, then I suggest trying approaches 2, 3 or 4 as described above.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • What is WAR file? I have a project symlink in `/var/lib/tomcat7/webapps/app` to my app directory and that's it and it work. – jcubic Dec 01 '13 at 13:23