prunsrv.exe Service not starting up

2020-06-08 13:37发布

I am trying to install and start a service with prunsrv.exe for an application

I am able to install the service alright but the service wont start up and gives me an error

enter image description here

Also following is the configuration that is used to install the service using prunsrv.exe

set SERVICE_NAME=TestService

REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=D:\setups\Commons_Daemon\commons-daemon-1.0.14-bin-windows\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_LOGLEVEL=INFO

REM Path to java installation
set PR_JVM=C:\Program Files\Java\jre1.6.0_04\bin\client\jvm.dll
set PR_CLASSPATH=D:\setups\Commons_Daemon\commons-daemon-1.0.14-bin-windows\temp.jar;

REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=java
set PR_STARTCLASS=Trys.AppLauncher
set PR_STARTMETHOD=start

REM Shutdown configuration
set PR_STOPMODE=java
set PR_STOPCLASS=Trys.AppLauncher
set PR_STOPMETHOD=stop

REM JVM configuration
set PR_JVMMS=64
set PR_JVMMX=128
set PR_JVMSS=4000

REM Install service
prunsrv.exe //IS//%SERVICE_NAME%

The above config is packaged to a batch file is executed to install the service

Also the log files are not generated, due which i cant even debug.

Please tell me where i am going wrong

9条回答
时光不老,我们不散
2楼-- · 2020-06-08 14:04

I was able to run the service on my local machine, but I got the same error on a VM running with Windows 2012R2.

The issue was caused by two reasons:

  1. reference to jvm.dll

On the VM I used a JDK installation instead of a simple JRE and the JAVA_HOME pointed to the JDK bin folder. I had to change the --Jvm parameter from "auto" to the actual jvm.dll file located in the JRE subfolder.

  1. amd64 version of prunsrv.exe

Allthough I changed the --Jvm setting, the service still showed the error during startup. I also had to use the amd64 version of prunsrv.exe to resolve the issue.

查看更多
家丑人穷心不美
3楼-- · 2020-06-08 14:08

If you're starting the service from the Service Manager and not the command line, you need to set the CLASSPATH, JAVA_OPTS etc in the registry. From here:

The basic Service definitions are maintained under the registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<ServiceName>

Additional parameters are stored in the registry at:

HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\ProcRun 2.0\<ServiceName>\Parameters

On 64-bit Windows procrun always uses 32-bit registry view for storing the configuration. This means that parameters will be stored inside:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\ProcRun 2.0\<ServiceName>
查看更多
祖国的老花朵
4楼-- · 2020-06-08 14:13

I had the same error but all I had to do is run the script as administrator (on windows server 2012)... Apparently the permission system on windows 2012 has changed: ex. on windows server 2008 this error did not occur (same script).

查看更多
登录 后发表回答