2

我在 windows server 2019 build 1809 上运行 java 程序作为 windows 服务。

我正在使用 apache commons procrun 创建 Windows 服务。

这是我启动服务的配置

"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

当我启动服务时,它失败并出现以下错误

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.

注意 - jvm.dll 在配置和错误日志中也有正确的路径。

我的配置

apache commons procrun 是 64 位的

我提供的 JRE 也是 64 位的

Windows 服务器也是 64 位的

让我知道是否需要任何其他详细信息

提前致谢。

4

2 回答 2

0

我们最近遇到了类似的问题,根本原因似乎是 Microsoft Visual C++ Redistributable 软件包的安装丢失或太旧:

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

安装/更新包服务后可以--StartMode=Jvm再次启动。

于 2020-11-05T15:44:04.457 回答
0

我无法找到问题的根本原因。

我解决问题的方法是将 StartMode 从 jvm 更改为 Java。

--StartMode=Java

它适用于 Windows 2016 Server、Windows 2019 Server 和 Windows 10 工作站。

如果有人有理由说明它不能与 jvm 选项一起使用,请告诉我。

于 2020-07-10T03:45:06.210 回答