0

I am trying to start Spring boot application as Windows service. I use Apache procrun for it.

My folder structure is:

|-C:\BillWeb
|      |-- BW3
|           |- BillWeb-0.0.1-SNAPSHOT.jar
|           |
|          public
|           |- here place for static files (index.html... etc..)

My command for installing service is:

prunsrv.exe //IS//BillWeb3 --DisplayName="BillWeb-RKCDB2" --Description="BillWeb of RKCDB2" --Startup=auto --Install=C:\BillWeb\prunsrv.exe --Jvm=auto --JvmMx=3500 --Classpath=C:\BillWeb\BW3\BillWeb-0.0.1-SNAPSHOT.jar --StartMode=Java --StartClass=com.ric.web.Bootstrap --StartMethod=start --StartParams=start --StopMode=Java --StopClass=com.ric.web.Bootstrap --StopMethod=stop --StopParams=stop --StdOutput=auto --StdError=auto --LogPath=C:\BillWeb\BW3\ --LogLevel=Debug

This service works well, but Spring boot doesn't see static files folder for web access.

http://192.168.100.200:8084/index.html  <- not accessible

But my service successfully find static files, when I use this:

cd C:\BillWeb\BW3
java -jar -Duser.language=en -Duser.region=us BillWeb-0.0.1-SNAPSHOT.jar

How can I correct this problem?

Leo
  • 1,029
  • 4
  • 19
  • 40

1 Answers1

1

According documentation:

--StartPath Working path for the start image executable.

I had to add --StartPath parameter for installing service, like this:

prunsrv.exe //IS//BillWeb3 --StartPath=C:\BillWeb\BW3\ --DisplayName="BillWeb-RKCDB2" ...

It completely solved my problem.

Leo
  • 1,029
  • 4
  • 19
  • 40