Starting and Stopping JBoss Application Server
Foreword
This article was written prior to the release of Application Server 6, and contains legacy data that might not be relevant for your particular installation or configuration needs. For start, stop and service configuration, refer to the user guides specific to your installation.
Before you begin
Before running JBoss Application Server, you will need to make sure that the environment variable points to your installed Java SDK.
On UNIX based system (Linux, Solaris, OS X): `which java` to find out the current JAVA_HOME. To set: `JAVA_HOME=...; export JAVA_HOME`
On Windows (NT based): right click on My Computer, click on Advanced, click on set Environment Variables. Set JAVA_HOME.
You should also add to the beginning of your .
Starting JBoss Application Server from the command line
To start JBoss AS, go the the directory of your installation and execute the run script appropriate for your system. (run.bat for Windows, run.sh for UNIX based systems). When you run JBoss AS, you should see output similar to the following:
[rubik:/tmp/jboss-3.2.3/bin] % ./run.sh ================================================================================ JBoss Bootstrap Environment JBOSS_HOME: /tmp/jboss-3.2.3 JAVA: java JAVA_OPTS: -Dprogram.name=run.sh CLASSPATH: /tmp/jboss-3.2.3/bin/run.jar:/lib/tools.jar ================================================================================ 17:06:59,351 INFO [Server] Starting JBoss (MX MicroKernel)... 17:06:59,372 INFO [Server] Release ID: JBoss [WonderLand] 3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445) 17:06:59,471 INFO [Server] Home Dir: /private/tmp/jboss-3.2.3 17:06:59,475 INFO [Server] Home URL: file:/private/tmp/jboss-3.2.3/ 17:06:59,492 INFO [Server] Library URL: file:/private/tmp/jboss-3.2.3/lib/ 17:06:59,502 INFO [Server] Patch URL: null 17:06:59,571 INFO [Server] Server Name: default ... 17:08:36,251 INFO [MainDeployer] Deployed package: file:/private/tmp/jboss-3.2.3/server/default/conf/jboss-service.xml 17:08:36,274 INFO [Server] JBoss (MX MicroKernel) [3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)] Started in 1m:36s:383ms
Once the started message appears, JBoss AS is running and is fully operational.
If you want to check if startup and initial deployment was successful without examining the log output, see the page StartupAndDeploymentCheck
Starting JBoss Application Server in the Background
By default, run.sh will start the JBoss AS java process in the foreground. Though Ctrl-C will kill the JBoss AS java process, if an external HUP or QUIT signal is sent to the run.sh process, it will kill the run.sh process, but the instance will live on.
In JBoss AS 4.0.5 and later, run.sh provides a new option to launch the process in the background; this option can be enabled by setting the LAUNCH_JBOSS_IN_BACKGROUND environment variable to a non-empty value, e.g.:
export LAUNCH_JBOSS_IN_BACKGROUND=1
When this option is enabled, run.sh will launch the JBoss AS process in the background and then relay any OS signals that are sent to the run.sh process to the JBoss AS process. This allows you to do something like the following in a jboss init.d script:
start() { export LAUNCH_JBOSS_IN_BACKGROUND=1 ./run.sh & echo $! >$JBOSS_PIDFILE } stop() { # This will kill the run.sh process AND the JBoss AS java process. kill `cat $JBOSS_PIDFILE` }
Note, the background launch option works on Cygwin, in addition to actual UNIX systems.
Stopping JBoss Application Server
If you launched JBoss AS from the command line, the easiest way to stop it is to press ctrl-C. JBoss AS should begin it's shutdown. Alternatively, you can invoke the shutdown script in the JBoss AS bin directory.
[rubik:/tmp/jboss-3.2.3/bin] % ./shutdown.sh -S Shutdown message has been posted to the server. Server shutdown may take a while - check logfiles for completion
There're several ways to shut the server down, as explained below. If you want to know what the server logs in each situation, please visit ShutdownLogs wiki.
Stopping JBoss Application Server (before AS 6.0 M3) on a remote machine
Note that you will use the lower-case -s flag along with the jnp protocol plus address and port of the Naming service specified in conf/jboss-service.xml
[rubik:/tmp/jboss-3.2.3/bin] % ./shutdown.sh -s jnp://myremotemachineOrIP:1099 Shutdown message has been posted to the server. Server shutdown may take a while - check logfiles for completion
For release AS 6.0 M3 or greater, use --host to specify the remote host:
% ./shutdown.sh --host=myremotemachineOrIP -S
Stopping JBoss Application Server (before AS 6.0 M3) when running multiple instances using the Service Binding Manager
You will again use the lower-case -s flag but you will need to look in your bindings file to find the port of each Naming service.
<service-bindings> <server name="ports-default"> <service-config name="jboss:service=Naming" delegateClass="org.jboss.services.binding.AttributeMappingDelegate" > <delegate-config portName="Port" hostName="BindAddress"> <attribute name="RmiPort">1098</attribute> </delegate-config> <binding port="1099" host="${jboss.bind.address}"></binding> </service-config> . . . <server name="ports-01"> <service-config name="jboss:service=Naming" delegateClass="org.jboss.services.binding.AttributeMappingDelegate" > <delegate-config portName="Port" hostName="BindAddress"> <attribute name="RmiPort">1198</attribute> </delegate-config> <binding port="1199" host="${jboss.bind.address}"></binding> </service-config> [rubik:/tmp/jboss-3.2.3/bin] % ./shutdown.sh -s jnp://localhost:1099 Shutdown message has been posted to the server. Server shutdown may take a while - check logfiles for completion
[rubik:/tmp/jboss-3.2.3/bin] % ./shutdown.sh -s jnp://localhost:1199 Shutdown message has been posted to the server. Server shutdown may take a while - check logfiles for completion
Stopping JBoss Application Server (AS 6.0 M3 or greater) when running multiple instances using the Service Binding Manager
use the --host option to specify the remote host and the --port option to specify the port. You can open (on the remote server) the JBossAS/server/all/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml and determine the correct port number to bind to. By default, the port number will be 1090 for "PortsDefaultBindings". For, each other binding, add 100 respectively to the port number. Port 1190 for Ports01Bindings. Port 1290 for Ports02Bindings. Port 1390 for Ports03Bindings.
% ./shutdown.sh --host=myremotemachineOrIP --port=1290 -S
Interfaces JBoss Application Server binds to
Up to JBoss AS 4.2 the server (HTTP and all services) bound to 0.0.0.0, meaning to all interfaces on the system. Since too many people have not secured internet facing systems this behaviour has been changed since JBoss AS 4.2.0. The Application Server now only binds to 127.0.0.1 by default. You can use the -b parameter with run.sh/run.bat to either bind to the desired IP or 0.0.0.0 if you want the pre 4.2 behaviour back. Make sure you go through the security guideline point by point since there are at least 5+ ways an unsecured AS instance can be taken over.
If bound to 0.0.0.0 clients will receive the hostname to connect to RMI. In this case you can set 'java.rmi.server.hostname=' to send an IP or different hostname to the client.
Mysterious Shutdowns
Some users have experienced MysteriousShutdowns with JBoss AS. These can be do to many things, such as user intervention, OS signals, programming error. If you have ruled everything else out, you may want to visit the MysteriousShutdowns wiki to see about further action.
Detecting the status of the Application Server
JBoss Application Server comes with TWIDDLE, a simple command line tool that may be used, manually or as part of a script, to indicate whether the server has been started successfully
Referenced by:
Comments