Undeploy or redeploy webapp in existing Tomcat - Advanced Installer Community
AndreG
Posts: 57
Joined: Tue Jun 10, 2014 11:41 am

Undeploy or redeploy webapp in existing Tomcat

I'm having difficulty getting some webapps to redeploy from an AI package, but I have no idea how to get around this issue..

To explain my environment, the system makes use of at least two installers:
  • One "base" installer - used for creating and configuring the base folder in which multiple applications reside, this also configures a Tomcat container as a Windows service and stores details in the registry (for later use).
  • Multiple "application" installers - each of these combine different applications installed to subfolders of the "base", a few of which also drop additional DLL and/or WAR files into the relevant Tomcat folders.
Here's the problem though: because the installer closes the Tomcat executable (probably because of the DLL files, but they're required for our apps), the service is not running when the WAR files are added/removed/replaced, which means Tomcat's automatic deployment doesn't trigger. Additionally, because the webapps deployment descriptors still exist in the "conf/Catalina/localhost/" folder, when Tomcat starts again it continues to run with the assumption that they're still deployed correctly. So in a nutshell, my installation package designed to update web applications in an existing Tomcat container doesn't actually update them.

All I want to do is stop AI from closing Tomcat, is this possible? If not, do I need to deploy these apps directly as expanded folders instead? Or perhaps "install" them to a temp folder and move them with a custom action at the end of the installer? I can't figure this out..
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Undeploy or redeploy webapp in existing Tomcat

Hello,

Please note that is the Windows Installer service which will stop the Tomcat service during installation if it is using a file (e.g. DLL) which is about to be updated by the current installation. This is the normal Windows Installer behavior and it cannot be avoided. As a workaround you can try to use some custom action to stop the Tomcat service and then launch it at the end of the installation.

Also, as another approach you can deploy the apps directly as expanded folders as you suggested. Just add their expanded resources in "Files and Folders" page. You can take a look on our "Unable to bundle a software using Tomcat Web Applciation" thread which should be useful.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
AndreG
Posts: 57
Joined: Tue Jun 10, 2014 11:41 am

Re: Undeploy or redeploy webapp in existing Tomcat

Daniel wrote:Please note that is the Windows Installer service which will stop the Tomcat service during installation if it is using a file (e.g. DLL) which is about to be updated by the current installation.
Ah, didn't realise that part.. I thought that was AI being too smart there. :) I actually tried the idea of stopping Tomcat during the installation then restarting it afterwards, but I couldn't see any difference in the overall behaviour.
Daniel wrote:Also, as another approach you can deploy the apps directly as expanded folders as you suggested.
This does appear to update the files as I expect it to, so this may be the best final solution. Our build scripts compile them to WAR files by default, so if I go this route I'll just tweak those a bit to copy the uncompressed "build" folder as well then. I'm fighting with finicky things in the installer dialogs at the moment, but I'll leave a comment on this thread if I either get stuck again or once I find a working solution.

I've never actually tried the "Tomcat Web Application" template though; from my initial reading it seems to target a "single web app" type of setup, which unfortunately won't work for us. I might be mistaken, so I'll look into it a bit more closely just now. Either way, thanks for the information.

Return to “Common Problems”