Jar file NOT running as windows service ( using Procrun )

1.9k views Asked by At

I am trying to run jar file as a service for the first time. I might have made some stupid mistake ( or a blunder ) . I am using 'procrun' to install jar file as a service. I could see my service NAME in windows Services but When I run that , It gives me below error.

" Windows could not start a PollerServiceMy" on local computer. For more information view system event log.----- refer to service specific error code 0. "

I am using the following batch file

set SERVICE_NAME=PollerServiceMy
set PR_INSTALL=C:\AbhijeetData\D\setup\commons-daemon-1.0.10-bin-windows\prunsrv.exe

REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=c:\logs
set PR_STDOUTPUT=c:\logs\stdout.txt
set PR_STDERROR=c:\logs\stderr.txt
set PR_LOGLEVEL=Error



REM Path to java installation
set PR_JVM=C:\Program Files\Java\jre7\bin\server\jvm.dll
set PR_CLASSPATH=C:\Users\FTLP4816\Desktop\ServiceJar\JavaApplication1\dist\JavaApplication1.jar

REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=com.property.CreatePropertyFrame
set PR_STARTMETHOD=start

REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=com.property.CreatePropertyFrame
set PR_STOPMETHOD=stop

REM JVM configuration
set PR_JVMMS=64m
set PR_JVMMX=128m
set PR_JVMSS=128m
set PR_JVMOPTIONS=-Duser.language=DE;-Duser.region=de

REM Install service
prunsrv.exe //IS//%SERVICE_NAME%

==========================================

Could anyone please let me know where am I missing ? Its also not creating the log files. Thanks in advance.

1

There are 1 answers

0
Tinil On

you need to pass the arguments

prunsrv //IS//TestService --DisplayName="Test Service" \ --Install=prunsrv.exe --Jvm=auto --StartMode=jvm --StopMode=jvm \ --StartClass=org.apache.SomeStartClass --StartParams=arg1;arg2;arg3 \ --StopClass=org.apache.SomeStopClass --StopParams=arg1#arg2

like the above code