Installing the JBoss Application Server




Installing the JBoss Application Server

Before going any further, make sure you have the Java SE JDK 5 or higher installed and correctly configured.

To download the JBoss binaries, go to the JBoss web site at http://www.jboss.com/products/jbossas/downloads. You should be able to start the installation process directly from this page by clicking the Run Installer link. The first few screens of the installer are self-explanatory. They ask for a license acceptance as well as the installation directory. When you get to the Installation Type screen, make sure that you choose the EJB 3.0 installation option, as shown in Figure W-1.

Figure W-1. Installation Type screen


The next screen allows you to choose what packages you want to have installed. For now, click Next and use the default settings. After the Packages screen, you will land on the Configuration Name screen shown in Figure W-2. Make sure you use the default value provided here because all of the workbook examples rely on this relative directory structure.

When the installation completes, you can launch JBoss by executing the run script in the $JBOSS_HOME/bin directory:

Unix:$ run.sh
Windows:C:\jboss-4.0.x\bin>run.bat

That's it! You now have a fully working JBoss server!

Figure W-2. Configuration Name screen


Discovering the JBoss Directory Structure

Installing JBoss creates the directory structure shown in Figure W-3.

Figure W-3. JBoss directory structure


Table W-1 describes the purposes of the various directories.

Table W-1. JBoss directories

Directory

Description

bin

Scripts to start up 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

Document Type Definitions (DTDs) 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. The configuration name will be what you picked in the Configuration Screen when installing JBoss in Figure W-2.)

server/default

JBoss' default configuration; used when no configuration name is specified on the JBoss command line.

server/default/conf

JBoss' configuration files. (You will learn more about the content of this directory in the next section.)

server/default/data

JBoss' database files (embedded database or JBossMQ, for example).

server/default/deploy

JBoss' 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.

server/default/log

JBoss' logfiles.

server/default/tmp

JBoss' temporary files.


If you want to define your own configuration, you can rerun the installer and choose a different configuration name when you get to the screen shown in Figure W-2. To start JBoss with a given configuration, use the -c parameter on the command line:

Windows:C:\jboss-
4.0.x
\bin> run.bat -c config-name
Unix:$ ./run.sh -c config-name

A run script with no parameters defaults to a configuration installed in the server/default directory.

JBoss Configuration Files

As the previous section described, JBoss' server directory can contain any number of directories, each representing a different JBoss configuration.

The server/default/conf directory contains JBoss' configuration files. The purpose of the various files is discussed in Table W-2.

Table W-2. JBoss configuration files

File

Description

jacorb.properties

JBoss IIOP configuration.

jbossmq-state.xml

JBossMQ (JMS implementation) user configuration.

jboss-service.xml

Definition of JBoss' services launched at startup (class loaders, JNDI, deployers, etc.).

log4j.xml

Log4J logging configuration.

login-config.xml

JBoss security configuration (JBossSX).


Deployment in JBoss

The deployment process in JBoss is straightforward. In each configuration, JBoss constantly scans a specific directory, $JBOSS_HOME/server/default/deploy, for changes. This directory is generally referred to informally as the deploy directory.

You can copy the following to this directory:

  • Any JAR library (the classes it contains are automatically added to the JBoss classpath)

  • An EJB-JAR

  • A Web Application aRchive (WAR)

  • An Enterprise Application aRchive (EAR)

  • An XML file containing JBoss MBean definitions

  • A directory ending in .jar, .war, or .ear and containing the extracted content of an EJB-JAR, a WAR, or an EAR, respectively.

To redeploy any of these 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, simply remove it from the deploy directory.