I am trying to setup a window service out of a spring boot fat jar using Apache Procrun. application is started successfully. But when I tried to stop the application by stopping the Windows service, it did not work. Spring boot 3.1.5 and 1.4.0.0 is the Apache procrun version.
Error logs from Apache Procurn :
[2024-11-17 21:06:45] [info] [20720] Service SERVICE_CONTROL_STOP signalled.
[2024-11-17 21:06:45] [info] [12804] Stopping service...
[2024-11-17 21:06:45] [error] [12804] Missing service ImageFile.
[2024-11-17 21:06:45] [error] [12804] The parameter is incorrect.
Procurn .bat :
@echo off
rem Set the path to the Java runtime
set JAVA_HOME=C:\Program Files\Java\jdk-21.0.1
rem Set the classpath for your Java application
set CLASSPATH=E:\USER\Other\Windows-service-R-D\sample.jar
rem Install the service using prunsrv
prunsrv //IS//XX ^
--Description "My Java Windows Service" ^
--Install "E:\USER\Other\Windows-service-R-D\prunsrv.exe" ^
--Jvm "%JAVA_HOME%\bin\server\jvm.dll" ^
--StartMode=jvm ^
--StartClass=.springframework.boot.loader.JarLauncher ^
--StartMethod main ^
--StopMode exe ^
--StopPath=E:\USER\Other\Windows-service-R-D\StopService.bat ^
--Classpath "%CLASSPATH%" ^
--LogPath="E:\USER\Other\Windows-service-R-D" ^
--LogPrefix=myapp ^
--Startup auto ^
--StdOutput "E:\USER\Other\Windows-service-R-D\stdout.txt" ^
--StdError "E:\USER\Other\Windows-service-R-D\stderr.txt"
StopService.bat:
@echo off
rem Use PowerShell to make a POST request
powershell -Command "Invoke-WebRequest -Uri http://localhost:7310/Sample/tf/turnOff -Method POST"
And I am able to stop my spring boot application by calling this StopService.bat from a cmd and PowerShell.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745629820a4637037.html
评论列表(0条)