3

I want to run ActiveMQ Artemis (2.10.1) as a Windows Service as a windows service on a Windows Server 2016. I followed the documentation:

On windows you will have the option to run ActiveMQ Artemis as a service. Just use the following command to install it:

$ ./artemis-service.exe install

It works very well as long as I switch user to an account with Administrator rights. However in the project I am working it would be preferable to run the service as a special "service user" account.

When one develops your own Windows service one can use the ServiceProcessInstaller.Account class/property to control which account is used for the service.

I guess this behavior is built into the artemis-service.exe binary and accompanying configuration file, artemis-service.xml.

However I cannot find any documentation or source code for this. Anyone knows?

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Are there any errors when you run the service as a dedicated service user? Has the service user access to the Artemis directories and files? – aventurin Nov 23 '19 at 11:43
  • 1
    @aventurin If I try to install the service using my normal user (without administrator rights) I get: `C:\Artemis\bin>artemis-service.exe install WMI.WmiException: AccessDenied vid WMI.WmiRoot.ClassHandler.Invoke(Object proxy, MethodInfo method, Object[] args) vid WMI.Win32ServicesProxy.Create(String , String , String , ServiceType , ErrorControl , StartMode , Boolean , String , String , String[] ) vid winsw.WrapperService.Run(String[] _args, ServiceDescriptor descriptor) vid winsw.WrapperService.Main(String[] args)` The same with start/stop on installed service – Magnus Johansson Nov 25 '19 at 06:52
  • @MagnusJohansson Did you ever solve the problem? I have exactly the same issue. – Anna Ira Hurnaus Sep 16 '20 at 13:40

1 Answers1

3

According to pom.xml during build of Artemis artemis-service.exe is pulled from Maven Repository Artifact winsw what is from WinSW on github. According to its documentation you have to specify the service account in the xml file:

Service account

It is possible to specify the useraccount (and password) that the service will run as. To do this, specify a element like this:

<serviceaccount>
   <domain>YOURDOMAIN</domain>
   <user>useraccount</user>
   <password>Pa55w0rd</password>
   <allowservicelogon>true</allowservicelogon>
</serviceaccount>

The <allowservicelogon> is optional. If set to true, will automatically set the "Allow Log On As A Service" right to the listed account.

Someone already tried to do something similar you are triying and opened the issue register service as local service and not system service #121.

BiNZGi
  • 1,347
  • 1
  • 14
  • 19