I'm trying to run Artifactory on Windows Server but the Artifactory service will not start. I'm running Windows Server 2016 Datacenter in a VM in Hyper-V. I have tried Server installs with and without the Windows GUI. Artifactory is installed via Chocolatey:
choco install Artifactory -y
When I try to start the service with PowerShell:
Start-Service Artifactory
I immediately get this error in PowerShell:
Service 'artifactory (Artifactory)' cannot be started due to the following error: Cannot start service Artifactory on computer '.'.
Windows event logs show these two errors in this order:
- A timeout was reached (30000 milliseconds) while waiting for the Artifactory service to connect.
- The Artifactory service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.
Again, these errors happen immediately so the timeout error is completely erroneous.
But I am able to manually start the Artifactory process:
C:\Program Files\artifactory\bin\artifactory.bat
commons-daemon.2017-08-10.log
[2017-08-10 10:02:53] [info] [ 2344] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:53] [info] [ 2344] Service Artifactory name Artifactory
[2017-08-10 10:02:53] [info] [ 2344] Service 'Artifactory' installed
[2017-08-10 10:02:53] [info] [ 2344] Commons Daemon procrun finished
[2017-08-10 10:02:54] [info] [ 3420] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:54] [info] [ 3420] Updating service...
[2017-08-10 10:02:54] [info] [ 3420] Service 'Artifactory' updated
[2017-08-10 10:02:54] [info] [ 3420] Update service finished.
[2017-08-10 10:02:54] [info] [ 3420] Commons Daemon procrun finished
[2017-08-10 10:02:54] [info] [ 1468] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:54] [info] [ 1468] Updating service...
[2017-08-10 10:02:54] [info] [ 1468] Service 'Artifactory' updated
[2017-08-10 10:02:54] [info] [ 1468] Update service finished.
[2017-08-10 10:02:54] [info] [ 1468] Commons Daemon procrun finished
[2017-08-10 10:02:54] [info] [ 1000] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:54] [info] [ 1000] Updating service...
[2017-08-10 10:02:54] [info] [ 1000] Service 'Artifactory' updated
[2017-08-10 10:02:54] [info] [ 1000] Update service finished.
[2017-08-10 10:02:54] [info] [ 1000] Commons Daemon procrun finished
[2017-08-10 10:02:54] [info] [ 5016] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:55] [info] [ 5016] Updating service...
[2017-08-10 10:02:55] [info] [ 5016] Service 'Artifactory' updated
[2017-08-10 10:02:55] [info] [ 5016] Update service finished.
[2017-08-10 10:02:55] [info] [ 5016] Commons Daemon procrun finished
[2017-08-10 10:02:55] [info] [ 4308] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:55] [info] [ 4308] Updating service...
[2017-08-10 10:02:55] [info] [ 4308] Service 'Artifactory' updated
[2017-08-10 10:02:55] [info] [ 4308] Update service finished.
[2017-08-10 10:02:55] [info] [ 4308] Commons Daemon procrun finished
[2017-08-10 10:02:55] [info] [ 1168] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:55] [info] [ 1168] Updating service...
[2017-08-10 10:02:55] [info] [ 1168] Service 'Artifactory' updated
[2017-08-10 10:02:55] [info] [ 1168] Update service finished.
[2017-08-10 10:02:55] [info] [ 1168] Commons Daemon procrun finished
artifactory-services.2017-08-10.log
[2017-08-10 10:02:56] [info] [ 3172] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:56] [info] [ 3172] Updating service...
[2017-08-10 10:02:56] [info] [ 3172] Service 'Artifactory' updated
[2017-08-10 10:02:56] [info] [ 3172] Update service finished.
[2017-08-10 10:02:56] [info] [ 3172] Commons Daemon procrun finished
[2017-08-10 10:02:56] [info] [ 540] Commons Daemon procrun (1.0.11.0 64-bit) started
[2017-08-10 10:02:56] [info] [ 540] Updating service...
[2017-08-10 10:02:56] [info] [ 540] Service 'Artifactory' updated
[2017-08-10 10:02:56] [info] [ 540] Update service finished.
[2017-08-10 10:02:56] [info] [ 540] Commons Daemon procrun finished
Using procmon I noticed that when I tried to start the 'artifactory' service it was starting 'artifactory-service.exe'. Trying to run that program directly myself resulted in the following error:
The system cannot find the Registry key for service 'artifactory-service' Load configuration failed The system cannot find the file specified. Commons Daemon procrun failed with exit value: 2 (Failed to load configuration) The system cannot find the file specified.
Checking procmon again shows that when I start 'artifactory-service.exe' it is trying to access registry entry 'HKLM\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\artifactory-service' and not finding it. I confirmed with regedit that this registry entry does not exist. I am inclined to think this is part of the reason the service is failing to start.
This seems to be caused by the artifactory-service.exe causing unnusual characters to be used inside the Service definition. After running installService.bat when I inspected the Service the "Path to executable" had
...\artifactory-pro-5.5.1\bin\artifactory-service.exe //RS//Artifactory
Where the unusual character is some strange unicode character such as this: http://www.fileformat.info/info/unicode/char/0cf4/index.htm
This seems to be caused by the artifactory-service.exe which is just an older version of the "Commons Daemon Service Runner" prunsrv.exe v1.0.11.0. I cannot find documentation of this error, so I do not know the underlying cause.
What I did to solve this was get the most recent version of prunsrv.exe v1.0.15.0 from a Tomcat 8 installation (tomcat8.exe) and renaming it artifactory-service.exe and placing it back in the %ARTIFACTORY_HOME%\bin installation folder. This allowed it to install and begin running without issue.