JBoss AS 7.1.1 as a service in Windows

First, download http://downloads.jboss.org/jbossnative/2.0.10.GA/jboss-native-2.0.10-windows-x86-ssl.zip and uncompress its contents over the JBoss  AS 7.1.1 directory and you should now have service.bat in bin/ directory.

Now you should modify service.bat as follows:

Replace all occurrences of run.bat with standalone.bat.

Replace all occurences of run.log with standalone.log.

Then, replace all occurrences of:

call shutdown -S < .s.lock >> shutdown.log 2>&1

With the following:

call jboss-cli.bat --connect --command=:shutdown >> shutdown.log 2>&1

Now, optionally, you can modify the following lines as follows:

...
set SVCNAME=JBAS711SVC
set SVCDISP=JBoss Application Server 7.1.1
set SVCDESC=JBoss Application Server 7.1.1
...

Now you have to comment out the following line by prepending REM to it.

...
REM Suppress killing service on logoff event
REM set JAVA_OPTS=-Xrs
...

And you need to create the following highlighted line in standalone.conf.bat, almost at the end, just before :JAVA_OPTS_SET:

...
set "JAVA_OPTS=%JAVA_OPTS% -Xrs"
:JAVA_OPTS_SET

It is very important to perform the previous step, otherwise, you could start experiencing issues when Windows users log off or during server shutdown/restart.

Finally, you just need to install the service as follows from an administrator Command Prompt:

And now you can set the service to Automatic start if you want, in which case, JBoss will start automatically upon Windows start.

References:

 

Leave a Reply

Your email address will not be published. Required fields are marked *