It was noticed on the users list, that it is not possible to install two copies of Tomcat with the same service name. http://markmail.org/message/rcmayrkydamywbpw It would be preferable to check for a duplicate name before starting the installation, but I do not know of a way to check existing service names in installer. Is there an API method, or maybe we can look up in the Registry? It looks that when this error occurs it is too late to go back to the configuration pages, or to specify a different name. At least we can tweak text of the message that appears. The current text is: "Failed to install Tomcat7 service. Check your settings and permissions. Ignore and continue anyway (not recommended)?" abort|retry|ignore
http://nsis.sourceforge.net/How_do_I_start/stop/create/remove/check_a_service
Created attachment 29251 [details] Check wheather a service of the same name is allready installed. Dear All, I'd like to propose the attached patch in svn diff format against trunk. After checking how tomcat.nsi got improved with r1139117 and further commits the attached patch addresses the check wheather a service of the same name is allready installed. The patch also applies to tc7.0.x/trunk and tc7.0.x/tags/TOMCAT_7_0_29. Regards, Ralph
-1 for the patch (attachment 29251 [details]) It does not check that a service is installed. What it checks is whether the "Tomcat Monitor" application is configured to auto-launch on Windows startup or not. That is quite a differing thing.
Created attachment 29289 [details] Check wheather a service of the same name is allready installed.
Dear Konstantin, thank you very much for the fast review. I'd like to explain why I checked for the Tomcat Monitor application whether it is configured to autolaunch: in tomcat.nsi $TomcatServiceName is also part of the registry entry stored for the Tomcat Monitor application and it seemed better to check that than to use an external NSIS library to read the installed services as suggested in comment 1. But you are absolutely right, it's better to check if a service of the same name is already installed. I looked a little further into MSDN documentation and found that services are also listed in the registry under HKLM SYSTEM\CurrentControlSet\Services\ so I changed the registry check in the patch. Please find the new patch attached. You can check that it works by installing the tomcat service and running the installer a second time. If a service of the same name exists, it prompts the user with a pop-up and remains on the configuration page. The patch is in svn diff format against trunk. Regards, Ralph
Do you have a link to MSDN page describing this?
http://msdn.microsoft.com/en-us/library/ms682544(v=vs.85) The SCM maintains a database of installed services in the registry. The database is used by the SCM and programs that add, modify, or configure services. The following is the registry key for this database: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. This key contains a subkey for each installed service and driver service.
Thanks for the patch. I fixed a typo - otherwise it was applied as provided. Fixed in: - trunk for 9.0.2 onwards - 8.5.x for 8.5.24 onwards - 8.0.x for 8.0.48 onwards - 7.0.x for 7.0.83 onwards