Debugging failed Windows services

If one of the programs fails to start as a Windows service, it can be difficult to determine the cause. Typically the service fails to start but gives no indication of why. The Windows Event log has nothing useful and the process might not have created its log file.

The usual cause is that the listening port is already taken, or that the user who is associated with the service has insufficient permissions to write to files on the local system.

The Java services are started by using the Apache Commons daemon. For reference, see: Procrun Documentation.

Ask for assistance from your local Windows administrator during this process.

This example looks at HCL DevOps Test Integrations and APIs (Test Integrations and APIs), but also works for the HTTP Proxy and HCL DevOps Test Virtualization Control Panel (Test Virtualization Control Panel).

Run the service on the command line

  1. Open the Windows Service and make a note of the name of it.

    In this case, the name is OneTestAPIAgent.

  2. Additionally, make a note of the user.

  3. Open a command window in the Test Integrations and APIs Agent installation folder. Run the service as a console application:
    
    prunsrv //TS//OneTestAPIAgent
  4. If this command works, compare the permissions of the user who is logged in with the one configured in the service. You might be able to run the command as the other user:
    
    runas /user:LOCALMACHINENAME\user "prunsrv //TS//OneTestAPIAgent"
    

Service Logging

  1. It is possible to add low-level logging to the service itself. Run the following command:
    
    prunmgr //ES//OneTestAPIAgent

  2. Set the Level to Debug and configure the Log path folder name.
  3. Restart the service and check the log files. Three log files are produced:
    • commons-daemon.2023-09-22.log
    • onetestapiagent-stderr.2023-09-22.log
    • onetestapiagent-stdout.2023-09-22.log