ActiveMQ Artemis를 Windows 서비스로 설치하는 방법은 무엇입니까?

ActiveMQ Artemis를 Windows 서비스로 설치하는 방법은 무엇입니까?

실행해야 하는 문서에 따르면 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/"/>

in 에서는 artemis-service.xml다음과 같이 해결됩니다.

-Djolokia.policyLocation=file:/C:/ArtemisBroker/etc//jolokia-access.xml org.apache.activemq.artemis.boot.Artemis

뭔가 잘못된 것 같지만 이것을 변경(하나를 제거 /)해도 아무 것도 변경되지 않습니다.

이 문제를 해결하는 방법은 무엇입니까?

답변1

Greg의 의견 덕분에 문제를 파악할 수 있었습니다. Sysinternals 프로세스 모니터를 사용하여 일부 필터링 후 다음 항목을 찾았습니다.

여기에 이미지 설명을 입력하세요

즉, 서비스 시작 시 시작을 위한 Java 실행 파일도 찾을 수 없습니다. 경로는 %JAVA_HOME%실제로 환경 변수를 찾을 수 없음을 보여줍니다 (그리고 프로그램은 하위 경로 문자열에 연결된 PATH를 검색합니다).

나는 변수를 설정했다고 확신했기 때문에 놀랐습니다. 내 실수는 변수를 시스템 변수가 아닌 사용자 변수로 설정했다는 것입니다. 분명히 Windows는 내가 로그인한 사용자로 다른 사용자로 서비스를 시작하므로 변수를 찾을 수 없습니다.

%JAVA_HOME%시스템 환경 변수로 설정하면 이 문제가 해결되었습니다.

관련 정보