procrun "cannot find registry key for service 'prunsrv'"

procrun "cannot find registry key for service 'prunsrv'"

我正在尝试使用 proc运行 运行 我的应用程序(在一个 fat jar 中)作为 windows 上的服务。具体来说,我的开发系统是 Server 2012。 我创建了一个像我见过的所有示例一样的批处理文件,但是当我尝试 运行 它(或者甚至只是 运行 prunsrv.exe 本身)时,我得到以下错误

c:\Users\kmilner\Desktop>c:\seven10\procrun\amd64\prunsrv
[2015-12-22 14:42:47] [warn]  [ 3132] The system cannot find the Registry key for service 'prunsrv'
[2015-12-22 14:42:47] [error] [ 3132] Load configuration failed
[2015-12-22 14:42:47] [error] [ 3132] The system cannot find the file specified.
[2015-12-22 14:42:47] [error] [ 3132] Commons Daemon procrun failed with exit value: 2 (Failed to load configuration)
[2015-12-22 14:42:47] [error] [ 3132] The system cannot find the file specified.

我不明白为什么要将服务名称分配给可执行文件的名称。这是我写的批处理文件,但是,当我只是 运行 没有任何参数的 prunsrv.exe 时,我再次得到相同的响应。

@cls
@if not "%1" == "" (
     @set PROCRUN_CMD=%1
) else (
     @set PROCRUN_CMD=TS
)

set APP_HOME=c:\myapp
set AGENT_HOME=%APP_HOME%\agent

set PROCRUN_EXEC=%APP_HOME%\procrun\amd64\prunsrv.exe

set AGENT_SERVICE_NAME=My-Agent

set SERVICE_LOG_PATH=%AGENT_HOME%\logs\windows

%PROCRUN_EXEC% %PROCRUN_CMD% %AGENT_SERVICE_NAME% ^
    --Install="%PROCRUN_EXEC%" ^
    --Description="My Service" ^
    --Classpath="%AGENT_HOME%\MyApp.jar" ^
    --StartClass=org.MyOrg.MyApp ^
    ++startParams="-s;%AGENT_HOME%\conf\settings.json" ^
    --StartMode="java" ^
    --Startup="auto" ^
    --StopClass=java.lang.System ^
    --StopMethod=exit ^
    --StopMode=jvm ^
    --logPath="%SERVICE_LOG_PATH%" ^
    --StdOutput="%SERVICE_LOG_PATH%\service-stdout.txt" ^
    --StdError="%SERVICE_LOG_PATH%\service-stderr.txt" ^
    --LogLevel="Debug"

@echo.

那么我在这里遗漏了什么导致了这个问题?我找不到其他答案。

它这样做的原因是因为我在 procrun 命令周围没有 //s。 :( 另外,正如我了不起的老板指出的那样,startParams 和 logPath 的情况是错误的。 我的错。但也许它会在完全相同的情况下帮助其他人。