Before going any further, make sure you have the J2SE JDK 1.4 or higher installed and correctly configured.
To download the
JBoss binaries, go to the JBoss
web site at http://www.jboss.org
and follow the Downloads link. There you will find all current
binaries in both zip
and
tar.gz
archive formats. Download the package
that best meets your needs.
Extract the downloaded archive in the directory of your choice. Under
Windows, you can use the WinZip
utility to
extract the archive content. Under Unix, you can use the following
commands:
$ gunzip jboss-4.0.tar.gz $ tar xf jboss-4.0.tar
Then change to the $JBOSS_HOME/bin
directory and
launch the run script that matches your OS:
Unix:
$ run.sh
|
Windows:
C:jboss-4.0in>run.bat
|
That’s it! You now have a fully working JBoss server!
Installing JBoss creates the directory structure shown in Figure 21-1.
Table 21-1 describes the purposes of the various directories.
Table 21-1. JBoss directories
Directory |
Description |
---|---|
bin |
Scripts to start and shut down JBoss. |
client |
Client-side Java libraries (JARs) required to communicate with JBoss. |
docs |
Sample configuration files (for database configuration, etc.) |
docs/dtd |
DTDs (Document Type Definitions) for the various XML files used in JBoss. |
lib |
JARs loaded at startup by JBoss and shared by all JBoss configurations. (You won’t put your own libraries here.) |
server |
Various JBoss configurations. (Each configuration must be in a different subdirectory. The name of the subdirectory represents the name of the configuration. As distributed, JBoss contains three configurations: minimal, default, and all.) |
server/all |
JBoss’s complete configuration; starts all services, including clustering and IIOP. |
server/minimal |
JBoss’s minimal configuration; starts only very basic services; cannot be used to deploy EJBs. |
server/default |
JBoss’s default configuration; used when no configuration name is specified on JBoss command line. |
server/default/conf |
JBoss’s configuration files. (You will learn more about the content of this directory in the next section.) |
server/default/data |
JBoss’s database files (embedded database or JBossMQ, for example). |
server/default/deploy |
JBoss’s hot-deployment directory. (Any file or directory dropped in this directory is automatically deployed in JBoss: EJBs, WARs, EARs, and even services.) |
server/default/lib |
JARs that JBoss loads at startup when starting this particular configuration. (The all and minimal configurations also have this directory and the next two.) |
server/default/log |
JBoss’s logfiles. |
server/default/tmp |
JBoss’s temporary files. |
If you want to define your own configuration, create a new
sub-directory under the server
directory
containing the appropriate files. To start JBoss with a given
configuration, use the -c
parameter on the command
line:
Windows:
C:jboss-
|
Unix:
$ ./run.sh -c
|
As the previous section described, JBoss’s
server
directory can contain any number of
directories, each representing a different JBoss configuration.
The server/config-name/conf
directory contains
JBoss’s configuration
files. The purpose of the various files is discussed in Table 21-2.
Table 21-2. JBoss configuration files
File |
Description |
---|---|
|
JBoss IIOP configuration. |
|
JBossMQ (JMS implementation) user configuration. |
|
Definition of JBoss’s services launched at startup (class loaders, JNDI, deployers, etc.). |
|
Log4J logging configuration. |
|
JBoss security configuration (JBossSX). |
|
Default configuration for JBoss’s legacy CMP 1.1 engine; contains JDBC-to-SQL mapping information for various databases, default CMP settings, logging configuration, etc. |
|
Default container configuration. |
|
Same as |
The deployment process in
JBoss
is straightforward. In each configuration, JBoss constantly scans a
specific directory for changes:
$JBOSS_HOME/server/config-name/deploy
. This
directory is generally referred to informally as the deploy
directory.
You can copy to this directory:
Any JAR library (the classes it contains are automatically added to the JBoss classpath)
An EJB JAR
A WAR (Web Application aRrchive)
An EAR (Enterprise Application aRchive)
An XML file containing JBoss MBean definitions
A directory ending in .jar
,
.war
, or .ear
and
containing respectively the extracted content of an EJB JAR, a WAR,
or an EAR
To redeploy any of the above files (JAR, WAR,
EAR, XML, etc.), simply overwrite it with a more recent version.
JBoss will detect the change by comparing the files’
timestamps, undeploy the previous files, and deploy their
replacements. To redeploy a directory, update its modification
timestamp by using a command-line utility such as
touch
. To undeploy a file,
just remove it from the deploy directory.