We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

AndreG
Posts: 57
Joined: Tue Jun 10, 2014 11:41 am

Tomcat Service - install using AI instead of batch file?

I would like to get my AI package to install and configure a Tomcat instance without having to rely on Apache's bundled "service.bat" file.. For the record, I love batch files, I've already restructured and trimmed this batch to install the service my way, but I would prefer to have AI handle this. Pretty sure this has been asked before, but I have some questions I haven't managed to find answers for yet that may help me figure out how to do this..

For reference, the batch file uses the following command to perform the actual service installation:

Code: Select all

"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop --Startup auto
Along with the following command for starting it afterwards:

Code: Select all

"%EXECUTABLE%" //RS//%SERVICE_NAME%
In AI's "Resources > Services" panel, I've got the service startup argument configured fine, but I'm not sure how to handle the "--StartClass", "--StopClass", "--StartParams" and "--StopParams" entries for the installation side. Checking documentation, the "Arguments" fields in both the "Services to Install" and "Control Operations" panels are both described as arguments that are "executed when the service starts".

Are these duplicate configuration point or are they intended for different things?
Is there any way to include these parameters during AI's "installing services" step?

From what I can tell, the difficulty I'm having here is coming up due to Tomcat and AI making use of different service wrappers (Apache uses "procrun", not sure what AI uses). Quite simply because procrun uses custom registry keys for service configuration.. Is my only option here to manually create the required registry entry structure at install time? Don't have any problem doing this, but I'm just wondering if there's a more efficient way to do this in the installer package itself.

Edit: With regards to the manual registry entry setup for procrun, how can I force AI to create a "REG_MULTI_SZ" entry instead of a "REG_SZ" if the data only has one word with a blank line after it? The "type" option is one selection for "REG_SZ/REG_MULTI_SZ" and the installer keeps stripping off the new line I place in the "data" value. For procrun to work, both "<service>\Parameters\Start\Params" and "<service>\Parameters\Stop\Params" must have the type "REG_MULTI_SZ".

Edit 2: Reading the docs, it appears the "Registry Value" dialog for Windows Mobile CAB Projects can be explicitly set as REG_MULTI_SZ, while the dialog for normal projects can not. Is there any chance of getting more control over this property in all projects...?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Tomcat Service - install using AI instead of batch file?

Hello,

I'm not sure the Tomcat service is compatible with our "Services" page support. The recommended way to install the Tomcat service is by using a custom action which launches the "service.bat" batch. Please take a look on the "Can't get custom Tomcat 7 to install as a Windows Service" thread which debates a similar topic.

Also, regarding how to create a "REG_MULTI_SZ" registry value containing one word with a blank line after it. here is how you can proceed:
- in the "Data" field add the following text:

myword
[EMPTY_PROP]


, where [EMPTY_PROP] is a formatted reference to a property whose value is empty.

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: Tomcat Service - install using AI instead of batch file?

Daniel wrote:Hello,

I'm not sure the Tomcat service is compatible with our "Services" page support. The recommended way to install the Tomcat service is by using a custom action which launches the "service.bat" batch. Please take a look on the "Can't get custom Tomcat 7 to install as a Windows Service" thread which debates a similar topic.
Hehe.. The thread you linked to was mine from mid-last year. :) I was missing a few simple points in that configuration, I have since then got it working as the linked thread describes in a few projects. I am having a few issues with user access levels and the services not installing unless the setup is launched with a "right-click > Run as Administrator" method. This is why I'm looking into other options now.
Daniel wrote:...where [EMPTY_PROP] is a formatted reference to a property whose value is empty.
Hmmm.. I don't see any property called "EMPTY_PROP" in the default list, so I'm assuming this needs to be created manually? Problem is, AI won't let me save the property in the "Install Parameters" page without a value. Any ideas?

Edit: Ok, I take that back.. Simply entering a formatted reference to "[EMPTY_PROP]" (without trying to define it myself) seems to do the trick. After this, the installer gave me an error about not being able to start the service (insufficient permissions), but it started correctly from the Services panel with the Procrun 2.0 configuration I built manually in the registry. All I need now is to get the installer to start the service itself and I'm sorted. :)
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Tomcat Service - install using AI instead of batch file?

Hello,

I'm not sure why the service start operation fails. Can you please make sure you are building a per-machine only installation type? Also, can you enable the "Run as administrator" option from "Install Parameters" page and see if this helped?

Also, maybe you could isolate the behavior in a buildable sample (.aip + its referred files) and send it us to support at advancedinstaller dot com so we can test and investigate it.

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: Tomcat Service - install using AI instead of batch file?

Daniel wrote:I'm not sure why the service start operation fails. Can you please make sure you are building a per-machine only installation type? Also, can you enable the "Run as administrator" option from "Install Parameters" page and see if this helped?

Also, maybe you could isolate the behavior in a buildable sample (.aip + its referred files) and send it us to support at advancedinstaller dot com so we can test and investigate it.
All our software needs to run completely user-agnostic, so I do use per-machine builds. Since we also deal with Windows Service installations more than standard desktop apps, the "Run as administrator" option is vital. On that same point; even though I increase the runtime level to administrator in the AI project, on some machines we still need to right-click the setup file and select the Windows "Run as Administrator" context menu option in order to install services..

Either way, I'm a bit swamped with other work at the moment, but I will see if I can replicate this behaviour in a smaller test project and let you know as soon as I have more info. At the moment this particular point isn't all that urgent though.

Return to “Building Installers”