
Installing JBoss AS 5
JBoss Application Server can be freely downloaded from the community site:
http://www.jboss.org/jbossas/downloads/.
Then, you'll soon be redirected to the SourceForge site where the project is hosted.
JBoss 5 is released in two different versions: jboss-5.0.0.GA.zip and jboss-5.0.0-jdk6.zip. The former version is the appropriate distribution if you are using JDK 1.5; the latter is the targeted release for JDK 1.6. Choose the appropriate distribution and start downloading.
Tip
At the time of writing, the newer stable release 5.1.0 of JBoss AS is available. The most important changes introduced by the new release include a new web administration console and the reactivation of the cluster farming option. For the purpose of running the examples of this book, you can safely use both the releases 5.0.0 and 5.1.0.
The installation of JBoss is simply a matter of extracting the compressed archive. Windows users can simply use any uncompressed utility, such as WinZip or WinRAR, taking care to choose a folder which doesn't contain empty spaces. Unix/Linux should use the unzip
shell command to explode the archive:
$ unzip jboss5.0.0.GA-jdk6.zip
Tip
Security warning:
Unix/Linux users should be aware that JBoss AS does not require root privileges, as none of the default ports used by JBoss are below the 1024 privileged port range. To reduce the risk of users gaining root privileges through the JBoss AS, install and run JBoss as a non-root user.
Starting up JBoss AS
After you have installed JBoss, it is wise to perform a simple startup test to validate that there are no major problems with your Java VM/operating system combination. To test your installation, move to the bin
directory of your JBOSS_HOME
directory. Once there, issue the following command:
run.bat # Windows users $ run.sh # Linux/Unix users
Here's a sample JBoss AS 5 startup console:

The previous command starts up JBoss AS and binds the application server to the localhost network interface. This means JBoss cannot be accessed from another machine in your network. The first thing you should learn is how to bind JBoss to the IP address of your machine; this can be achieved with the -b
option as follows:
run.bat -b 192.168.10.1 # Windows Users run.sh -b 192.168.10.1 # Unix/linux Users
Here the server is bound to the IP address 192.168.10.1.
You can verify that the server is reachable from the network by simply pointing the browser to http://192.168.10.1:8080
.

Tip
Introducing the twiddle utility
One useful command-line utility that ships with JBoss is twiddle. This is a needful shell command located inside the JBOSS_HOME/bin
folder. It can be used if you don't have a graphical terminal where you can manage JBoss, or if you want to control JBoss with shell scripts.
The syntax of twiddle is basically built into 3 pieces:
twiddle [options] <command> [command_arguments]
Here's an example command line for checking JBoss status:
twiddle -s 192.168.0.1 get "jboss.system:type=Server" Started
Stopping JBoss
Probably the easiest way to stop JBoss is sending an interrupt signal with the Ctrl + C key combination.
However, if your JBoss process was launched in the background or is running on another machine (see the next section), then you have to use the shutdown
command from the bin
folder:
shutdown -S # Windows Users ./shutdown.sh -S # Unix/Linux Users
The shutdown
script can also be used to shut down a remote JBoss server, contacting the JBoss naming provider on the remote host.
./shutdown.sh -s jnp://remoteHost:1099 Shutdown message has been posted to the server. Server shutdown may take a while - check logfiles for completion
Tip
Unexpected shutdown?
Unix users sometimes reported unexpected shutdown of JBoss server.
For those who are not familiar with the Unix environment, when the terminal hangs up (drops the connection) the operating system sends a SIGHUP signal to all the programs that are launched from that terminal.
As Sun JVM monitors for SIGHUP signal, it can be interpreted as a signal to shut down. The workaround is to add the -Xrs
option when launching JBoss. This is an option of the JVM, which reduces the use of operating system signals by the Java Virtual Machine.