2

I just packaged my maven web application into a war file, upload it to remote server which has installed the tomcat environment. After I unpacked my war file and put all files in the /webapps/ROOT directory, I run bin/startup.sh to fire up the tomcat.

This just works fine, but when I intend to change my web application and redeploy it on the server, I don't know how to do that seamlessly, that is to say, not letting the users who is using my website lose any request.

Could anyone give me some idea? Thanks a lot!

Judking
  • 6,111
  • 11
  • 55
  • 84

2 Answers2

0

You can always use manager app coming with tomcat to deploy a war without bringing the website down, even from a remote machine using browser.

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely

Subin Sebastian
  • 10,870
  • 3
  • 37
  • 42
0

You may use reverse proxy as door of you site. After deploying your "second" war into Tomcat, you can change the configuration of reverse proxy and reload it. The reloading of reverse proxy is very speedy, so that it likes "seamless" re-deployment of Java web application. After the reloading of reverse proxy, you could un-deploy "first" war of application safely.

This way to re-deploy is especially useful if the application needs time for initialization(for example: including ORM, Spring Framework...).

There are few concerns about using multiple-war-at-the-same-time:

1) There will be two applications(although, temporary) running on your Tomcat concurrently, make sure there is nothing hazard about concurrent executing. For example: scheduled jobs

2) You need to confirm that there is enough memory on Tomcat to live with two web applications, or Tomcat may hang.

3) Be meticulous about Java.lang.OutOfMemory: PermGen Space problem

Mike Lue
  • 839
  • 4
  • 8