The AS7 book!

JBoss Tuning

JBoss 5 book

No Registration required. Use your FB account to add comments to articles.

Twitter Button

Poll

Which is your favourite JSF library?
 
Top Programming Sites
Home JBoss AS Run JBoss as Service HowTo

Run JBoss as Service HowTo

  

A short tutorial for JBoss administrator which illustrates how to start JBoss AS as Service both in Windows environment and in Unix-Linux environment.

 

start jboss as service howto
Windows users should use the service,bat shell command which is located into the JBOSS_HOME/bin folder. The service.bat commands needs at least one parameter to run:

C:\jboss-5.0.0.GA\bin>service
Usage: service install|uninstall|start|stop|restart|signal



In order to install JBoss AS as Windows service launch:

C:\jboss-5.0.0.GA\bin>service install

Now JBoss AS should me enlisted in the Windows Service List, which can be found in the control panel.
run jboss as service
Now you can use both the Windows service applet or the service.bat command to start the service. Example:

Starting JBoss AS service:

C:\jboss-5.0.0.GA\bin>service start



run jboss as serviceLinux applications use System V Init scripts to run an application when the machine boots.
Basically, the scripts which start a service are placed in:
/etc/rc.d/init.d/   (other distributions: /etc/init.d/)

The same scripts need to be linked as:
/etc/rc.(x)/  (Prefixed with S for start and K for stop)


We suggest you reading a good tutorial about Linux Init scripts if you are new to this:
http://www.linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts

JBoss AS distribution includes a few shell commands which are located in the JBOSS_HOME/bin folder.

jboss_init_hpux.sh
jboss_init_redhat.sh
jboss_init_suse.sh

Copy the appropriate file for your distribution into the /etc/rc.d/init.d folder

cp jboss_init_redhat.sh /etc/rc.d/init.d/jboss



Now you should create a link for each System level so that Linux/Unix knows at which level the application server needs to be started:

ln -s /etc/rc.d/init.d/jboss /etc/rc3.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc5.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc4.d/S84jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc6.d/K15jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc0.d/K15jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc1.d/K15jboss
ln -s /etc/rc.d/init.d/jboss /etc/rc2.d/K15jboss


We don't go deep into the details of Linux startup system but the links targeted as "S" are launched to start the service at a certain system level. The scripts marked with "K" are launched when the server is shuitting down.

As additional step you need to create a "log" folder in the JBOSS_HOME dir, where the service will send logging:  

mkdir $JBOSS_HOME/log