
標題有點誤導,因為我知道如何將 artemis 安裝為 Windows 服務,根據文檔,只需運行
artemis-service.exe install
這對我不起作用。我嘗試使用 ActiveMQ Artemis 版本 2.31 和 2.29 安裝並執行該服務。對於這兩個版本,運行該服務都會產生以下登入訊息artemis-service.wrapper.log
2023-10-23 10:19:50,116 DEBUG - Starting WinSW in the service mode
2023-10-23 10:19:50,147 INFO - Starting %JAVA_HOME%\bin\java.exe -XX:+UseParallelGC -Xms512M -Xmx1024M -classpath "C:\Program Files (x86)\apache-artemis-2.31.0\lib\artemis-boot.jar" "-Dartemis.home=C:\Program Files (x86)\apache-artemis-2.31.0" -Dartemis.instance=C:\ArtemisBroker -Ddata.dir=C:\ArtemisBroker\data -Dartemis.instance.etc=C:\ArtemisBroker\etc -Djava.security.auth.login.config=C:\ArtemisBroker\etc\login.config -Dhawtio.disableProxy=true -Dhawtio.realm=activemq -Dhawtio.offline="true" -Dhawtio.role=amq -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=file:/C:/ArtemisBroker/etc/jolokia-access.xml org.apache.activemq.artemis.boot.Artemis run
2023-10-23 10:19:50,178 DEBUG - Completed. Exit code is 0
並彈出以下警告:
提供某種提示的唯一來源是 Windows 事件日誌,其中包含以下條目:
Service cannot be started. System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at winsw.Util.ProcessHelper.StartProcessAndCallbackForExit(Process processToStart, String executable, String arguments, Dictionary`2 envVars, String workingDirectory, Nullable`1 priority, ProcessCompletionCallback callback, Boolean redirectStdin, LogHandler logHandler, Boolean hideWindow)
at winsw.WrapperService.StartProcess(Process processToStart, String arguments, String executable, LogHandler logHandler, Boolean redirectStdin)
at winsw.WrapperService.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
我檢查了執行命令中的所有路徑,但一切似乎都很好。
我唯一注意到的是條目
<startargument>-Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%/jolokia-access.xml</startargument>
和
<env name="ARTEMIS_INSTANCE_ETC_URI" value="file:/C:/ArtemisBroker/etc/"/>
,然後artemis-service.xml
解決
-Djolokia.policyLocation=file:/C:/ArtemisBroker/etc//jolokia-access.xml org.apache.activemq.artemis.boot.Artemis
這似乎有點錯誤,但改變這一點(刪除一個/
)不會改變任何東西。
如何解決這個問題?