2

I am running a java program as a windows service on windows server 2019 build 1809.

I am using apache commons procrun to create a windows service.

This is my configuration to start a service

"C:\Users\Public\agent\commons-daemon-1.2.1-bin-windows\amd64\prunsrv.exe" //IS//ic^
--DisplayName "Agent"^ --Description "This is a Agent Windows Service."^
--Startup=auto^
--Install="C:\Users\Public\agent\commons-daemon-1.2.1-bin-windows\amd64\prunsrv.exe"^
--Jvm="C:\Users\Public\agent\jre\bin\server\jvm.dll"^
--Classpath "C:\Users\Public\agent\agent-jar-with-dependencies.jar"^
++Environment="PATH='C:\Windows\system32';'C:\Users\Public\agent\jre\bin'"^
--JavaHome="C:\Users\Public\agent\jre"^
--StartPath=C:\Users\Public\agent\^
--StartMode=jvm^
--StartClass=com.agent.int.Runner^
--StdOutput=C:\Users\Public\agent\service-stdout.log^
--StdError=C:\Users\Public\agent\service-stderr.log

When i start the service, it fails with below error

2020-06-26 07:27:52 Apache Commons Daemon procrun stderr initialized. 
[2020-06-26 07:27:52] [error] [5716] Failed creating Java 'C:\Users\Public\agent\jre\bin\server\jvm.dll'. 
[2020-06-26 07:27:52] [error] [ 5716] The specified module could not be found. 
[2020-06-26 07:27:52] [error] [ 5716] ServiceStart returned 1. 
[2020-06-26 07:27:52] [error] [ 5716] The specified module could not be found.

Note - jvm.dll has correct path in configuration and in error log as well.

My configurations

apache commons procrun is 64 bit

JRE which i am supplying is also 64 bit

Windows server is also 64 bit

Let me know if any other details required

Thanks in advance.

SRJ
  • 2,092
  • 3
  • 17
  • 36

2 Answers2

0

I was not able to find root cause of the issue.

The way i solved the issue is i changed StartMode from jvm to Java.

--StartMode=Java

It worked on Windows 2016 Server, Windows 2019 Server and Windows 10 workstation.

Let me know if anyone has a reason for why it didn't work with jvm option.

SRJ
  • 2,092
  • 3
  • 17
  • 36
0

We faced a similar issue lately and the root cause seemed to be a missing or too old installation of the Microsoft Visual C++ Redistributable package:

https://support.microsoft.com/de-de/help/2977003/the-latest-supported-visual-c-downloads

After installation/update of the package services could be started with --StartMode=Jvm again.

dpr
  • 10,591
  • 3
  • 41
  • 71