V
V
vyn2016-05-01 20:02:01
Java
vyn, 2016-05-01 20:02:01

Java as windows service?

Good time of the day!
The task is to run the jar as a windows service. To do this, I use prunsrv.exe from Apache ( commons.apache.org/proper/commons-daemon/procrun.html). The problem is that when using Java mode, I run into the problem "The data area passed in the system call is too small." Please help me figure out what the problem is and fix it.
Here are the options passed to prunsrv.exe
set OPTIONS=--JvmOptions=-Xss4M;-Xmx512M;-Xms256M;-Dbasedir="%HOME%";-Dapp.home="%HOME%";-Dapp.name=" jService";-Dsun.net.inetaddr.ttl=90;-XX:+HeapDumpOnOutOfMemoryError;-XX:HeapDumpPath="%JSERVICE_HEAP_LOG%" ^
--StartMode=Java --StartClass=com.inet.jservice.WebSocketCryptographyDaemonController --StartParams="start" --StartMethod=main --StopMode=Java --StopClass=com.inet.jservice.WebSocketCryptographyDaemonController --StopParams="stop " --StopMethod=main ^
--LogPath="%LOG_HOME%" --PidFile="%PID_FILE%" --StdOutput="%PRUNOUT_LOG%" --StdError="%PRUNERR_LOG%" --LogLevel=Debug ^
- -Startup=auto --Classpath="%JSERVICE_PATH%" --Description="123"
Then
".\prunsrv.exe" //IS//"jService" %OPTIONS%
".\prunsrv.exe" //ES/ /"jService"
prunsrv logs
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1679) [ 4328] Commons Daemon procrun log initialized
[2016-05-02 10:11:03] [info] ( prunsrv.c:1683) [ 4328] Commons Daemon procrun (1.0.15.0 32-bit) started
[2016-05-02 10:11:03] [debug] ( prunsrv.c:561 ) [ 4328] Installing service...
[2016-05-02 10:11:03] [info] ( prunsrv.c: 600 ) [ 4328] Service jService name
[2016-05-02 10:11:03] [debug] ( prunsrv.c:616 ) [ 4328] Setting service description Cryptography web socket service,Inet Company Ltd.,2016
[2016- 05-02 10:11:03] [info] ( prunsrv.c:634 ) [ 4328] Service 'jService' installed
[2016-05-02 10:11:03] [info] ( prunsrv.c:1764) [ 4328] Commons Daemon procrun finished
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1679) [ 6580] Commons Daemon procrun log initialized
[2016-05-02 10:11:03] [info ] ( prunsrv.c:1683) [ 6580] Commons Daemon procrun (1.0.15.0 32-bit) started
[2016-05-02 10:11:03] [info] ( prunsrv.c:725 ) [ 6580] Starting service 'jService' ...
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1679) [ 2916] Commons Daemon procrun log initialized
[2016-05-02 10:11:03] [info] ( prunsrv.c: 1683) [ 2916] Commons Daemon procrun (1.0.15.0 32-bit) started
[2016-05-02 10:11:03] [info] ( prunsrv.c:1596) [ 2916] Running 'jService' Service...
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1374) [ 2572] Inside ServiceMain...
[2016-05-02 10:11:03] [debug] ( prunsrv.c: 844 ) [ 2572] reportServiceStatusE: 2, 0, 3000, 0
[2016-05-02 10:11:03] [info] ( prunsrv.c:1127) [ 2572] Starting service...
[2016-05-02 10:11:05] [error] ( prunsrv.c:746 ) [ 6580] Failed to start 'jService' service
[2016-05-02 10:11:05] [error] ( prunsrv.c:746 ) [ 6580 ] The data area passed by the system call is too small.
[2016-05-02 10:11:05] [info] ( prunsrv.c:754 ) [ 6580] Start service finished.
[2016-05-02 10:11:05] [error] ( prunsrv.c:1755) [ 6580] Commons Daemon procrun failed with exit value: 5 (Failed to start service)
[2016-05-02 10:11: 05] [error] ( prunsrv.c:1755) [ 6580] Data area passed via system call is too small.
Are some parameters not being passed to prunsrv.exe? Wrong JRE being used? Or do you need a JDK?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fairlancer, 2016-05-02
@kursorik2

Run the file with SYSTEM privileges (on Windows), on Linux just run it with sudo or root.
You can create a sh/bat script that will do all the work for you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question