jbossjboss7.xjboss-eap-6procrun

JBoss EAP 6.2 running as Window Service with prunsrv - Can't stop service


I'm trying to get JBoss EAP 6.2 running as a window service on Windows Server (64bit). I've define the service with prunsrv as follows:

prunsrv install "JBoss EAP" --DisplayName="JBoss EAP" --LogLevel=DEBUG --LogPath=d:\Java\jboss-eap-6.2\domain\log\ --LogPrefix=service --StdOutput=auto --StdError=auto --StopTimeout=10 --StartMode=exe --StartImage=cmd.exe --StartPath=d:\Java\jboss-eap-6.2\bin ++StartParams="/c;domain.bat" --StopMode=exe --StopImage=cmd.exe --StopPath=d:\Java\jboss-eap-6.2\bin ++StopParams="/c;jboss-cli.bat;--controller=192.168.50.3:8888;--connect;command=/host=master:shutdown"

and I changed the logon user for the service so that it runs under an account that is part of the Administators group.

I'm able to start the service just fine but I can't get it to stop properly. By "properly" I mean when I stop the service, I get the Service Control dialog that says:

"Windows is attempting to stop the following service on the local computer"

Watching the JBoss log file I can see that JBoss shuts down properly and with Task Manager I can see that all the Java.exe processes disappear. However, the Service Control dialog does not close 'normally'. It eventually times out and I get another dialog with "Error 1053: The service did not respond to the start or control request in a timely mannger" and Task Manager shows prunsrv.exe still running. The service is then hung up in a "Stopping" state and I have to use TaskKill to kill the task and reset the service to a state where I can restart it.

When I look in the service.*.log file, I see the following:

[2015-09-11 11:42:55] [debug] ( prunsrv.c:844 ) [25200] reportServiceStatusE: 4, 0, 0, 0
[2015-09-11 11:42:57] [debug] ( prunsrv.c:844 ) [25200] reportServiceStatusE: 4, 0, 0, 0
[2015-09-11 11:42:57] [debug] ( prunsrv.c:844 ) [25200] reportServiceStatusE: 3, 0, 3000, 0
[2015-09-11 11:42:57] [info]  ( prunsrv.c:943 ) [10984] Stopping service...
[2015-09-11 11:42:57] [debug] ( prunsrv.c:1057) [10984] Waiting for stop worker to finish...

I have been trying for a couple of days to figure out what the problem is but I've hit a wall and I'm out of ideas. So far, LogLevel=DEBUG hasn't shed any light on the problem so I'm looking for ideas that might help me debug this. Can anyone give me a suggestion?

Thanks


Solution

  • As it turned out, the problem was with the startup command I was using. The startup command needed a "set NOPAUSE=Y" at the front of it. E.g.

    ++StartParams="/c;set;NOPAUSE=Y;&&;domain.bat"
    

    Once I added that, it did the trick.