# How to start WAS Liberty as a Windows service for CLM 6.0.1?

 0 1 Jeffery Hanson (147●2●6●11) | asked Jan 08 '16, 5:07 p.m. JAZZ DEVELOPER WAS Liberty has replaced Apache Tomcat as the out of the box application server. It was well documented how to start Tomcat as a Windows service. There is no equivalent documentation for WAS Liberty. Searching Google has not returned any useful results. Has anyone figured out how to do this?

 9 Roberto Sanchez Herrera (286●2) | answered Jan 12 '16, 4:07 p.m. Just to add more more information to Shubjit's answer. There is already a RFE for Liberty fo running it as a Windows service: https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=29865 As Shubjit pointed out, using Apache Commons Daemon is an option. Here is what I did to create the service using Apache Commons Daemon to run CLM 601 in Liberty, I hope it helps: 1. Download the binaries for Windows from http://www.apache.org/dist/commons/daemon/binaries/windows/ 2. Unzip the downloaded file 3. Run the following script to create a Manual service. You need to change the values in the variables, and you might need to change other values too (e.g.  --Startup if you want this service to be automatic): @echo off set DAEMON_EXEC="C:\commons-daemon-1.0.15-bin-windows\amd64\prunsrv.exe"set SERVER_START_COMMAND="C:\CLM\6.0.1\server\server.startup.bat"set SERVER_START_COMMAND_PATH="C:\CLM\6.0.1\server"set SERVER_STOP_COMMAND="C:\CLM\6.0.1\server\server.shutdown.bat"set SERVER_STOP_COMMAND_PATH="C:\CLM\6.0.1\server"set LOG_PATH="C:\CLM\6.0.1\server\logs\daemon"set SERVICE_NAME=CLM601_LIBERTYset SERVICE_DISPLAY_NAME="CLM 6.0.1 running in Liberty Profile"set SERVICE_DESCRIPTION="CLM 6.0.1 running in Liberty Profile"set INSTALL_SERVICE_COMMAND=%DAEMON_EXEC% //IS//%SERVICE_NAME%  --Startup=manual --DisplayName=%SERVICE_DISPLAY_NAME% --Description=%SERVICE_DESCRIPTION% ++DependsOn=Tcpip --LogPath=%LOG_PATH% --StdOutput=auto --StdError=auto --StartMode=exe --StartPath=%SERVER_START_COMMAND_PATH% --StartImage=%SERVER_START_COMMAND% --StopMode=exe --StopPath=%SERVER_STOP_COMMAND_PATH% --StopImage=%SERVER_STOP_COMMAND%%INSTALL_SERVICE_COMMAND%  Ralph Schoon selected this answer as the correct answer Comments 1 Jeffery Hanson commented Mar 08 '16, 7:33 p.m. JAZZ DEVELOPER WOW!! This was the perfect answer. I had the CLM WAS Liberty process running as a service in short order. This was easier than setting up Apache/Tomcat! Roberto, thanks so much for posting such a complete and succinct solution. You rock! Brian Lahaie commented Apr 14 '17, 6:20 p.m.  Agreed, this is a perfect answer.  It took me literally 10 minutes to configure Liberty to run as a Windows service.

 2 Shubjit Naik (1.4k●1●6●13) | answered Jan 08 '16, 9:39 p.m. edited Jan 08 '16, 9:40 p.m. Hi Jeffery I found this forum link and there is a user who has confirmed that it works. Comments Ian Barnard commented May 16, 12:31 p.m. JAZZ DEVELOPER Hi Shubjit I've tried the Apache Daemon and yes functionally it successfully creates a Windows service which can be started/stopped. It seems particularly nice because it uses the server.startup.bat it's easy to change the JVM parameters. The catch I've found is that Windows (at least 2012 R2 and 2016 server editions) is so keen/desperate to stop services quickly during shutdown that it ignores the fact that Liberty hasn't actually stopped and just shuts down regardless, stopping Liberty dead of course. At the next startup the rm log often shows that RM wasn't shut down properly - this is risking RM index corruption which may require a full reindex. I've done some searching and while there should be a registry variable WaitToKillServiceTimeout which should be able to extend how long Windows waits, it doesn't seem to have any effect. It seems that using Apache Daemon is in the "sort of works but can cause lurking problems" category - it definitely seems dangerous when running DOORS Next Generation. And of course it's formally not supported. Robert Carter commented May 16, 12:37 p.m. You might want to try this solution and see if it successfully "blocks" Windows from shutting down until Liberty is fully shutdown. Ian Barnard commented May 17, 6:06 a.m. | edited May 17, 6:24 a.m. JAZZ DEVELOPER Hi Robert - yes @kenny smith contributed the same answer, and Kenny's method like the Apache Daemon method works perfectly well to start/stop Liberty manually but I couldn't get it to work any better during Windows shutdown - so Liberty (and presumably DB2 which I have on this same test env) is still being stopped dead.

 0 Thomas Piccoli (31●2●1) | answered Mar 31 '17, 9:51 a.m. JAZZ DEVELOPER Can't seem to comment on this topic so asking a question in the answer box.  The Apache document says the following: Both Win32 and UNIX like platforms are supported. For Win32 platforms use procrun. For UNIX like platforms use jsvc. Has anyone used this on a 64x windows system Comments Shubjit Naik commented Mar 31 '17, 10:00 a.m.  Hi Thomas Yes we tested this on Windows 64 bit and it worked. We have included this in our deployment Wiki. Thomas Piccoli commented Apr 01 '17, 4:01 p.m. JAZZ DEVELOPER Thank you Shubjit, I followed the wiki and everything worked fine except for the daemon logs.  The "C:\IBM\JazzTeamServer\server\logs" folder does not exist until WLP has been started once so the first messages are missed.

 0 Ian Barnard (193●6●9) | answered May 16, 12:44 p.m. JAZZ DEVELOPER edited May 16, 1:06 p.m. As I said above, I have tried Apache Daemon with multiple versions 6.0.5 - 6.0.6.1 and while it works in terms of creating a Windows service that can be started and stopped, my experience was that there is definitely a problem cleanly stopping liberty and the apps running in it during Windows shutdown. What seems to happen is that Windows is so keen to shutdown quickly that it waits a nominal 12 seconds then carries on shutting down. On my VM, manually stopping the service takes about 25s for Liberty to exit and release RAM, watching Task Manager. From the same starting point with the service running I can restart Windows in 15s - this has to be stopping Liberty and DB2 dead, in the middle of whatever it was doing. This is a hazard for at least DOORS Next Generation, which on subsequent startup often complains that the app wasn't cleanly shutdown - and if it wasn't cleanly shutdown this is risking index corruption which might require a full reindex. And of course running Liberty as a service is formally not supported. As a result I'd avoid Apache Daemon on any production/staging environment which might have non-admin-initiated server shutdown/restarts. Be great if anyone can tell me how to configure Windows to be more patient?

 0 Kenny Smith (252●4●9) | answered May 16, 3:04 p.m.  A MUCH easier way is to use the WIndows task panels. This requires no external tool, libraries, or shell scripts.  I've documented that here: Comments Ian Barnard commented May 17, 6:02 a.m. JAZZ DEVELOPER Hi Kenny I really wanted your solution to work, but I couldn't get it to. In fact restart was even faster using your method of shutdown - I got as low as 6s. I'm using Windows 2012R2 Server. What version of Windows are you using? How did you confirm that shutdown completes cleanly? If the shutdown happens significantly quicker than the time Liberty normally takes to free all the memory it is allocated in response to a manual shutdown then it was too quick. The only way I know to confirm that shutdown wasn't clean is that during subsequent Liberty startup in rm.log DOORS Next Generation displays "CRJZS6073W The server did not shut down properly, which might have corrupted the RDF indexes located at C:\IBM\JazzTeamServer\server\conf\rm\indices\...." Kenny Smith commented May 17, 8:30 a.m.  I've used this on Windows 2012 server (not sure the revision of it), as well as Windows 10 (my local laptop). I've not noticed this issue when I've done this. I'll go back and check my instructions just to make sure I've got every step listed.

 0 foa solution (11) | answered May 18, 2:30 a.m.  I need help windows service for CLM 6.0.1is not working properly. Comments Ralph Schoon commented May 20, 6:09 a.m. FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Here some suggestions: Do not answer on an old accepted question with a new question  Create your own question The question above does not contain any information that could reasonably be used - contact support or provide information e.f. see How should I ask a question in the Forum if I want to receive useful answers? I would have converted this into a question, but there is nothing in there that would be actionable