Chapter 1. First steps

Table of Contents

Installing Ant
Installing JBoss
Downloading the Documentation Example Source
Creating the Bean
EJBs: review
Review the EJB Classes
The deployment descriptor
Packaging and deploying the bean
Coding and compiling the test client

Authors:Kevin Boone <>

Tobias Frech <>

Scott Stark <>


What this section is about

This section presents a step-by-step tutorial on how to set up 'JBoss', the free Enterprise JavaBean (EJB) server, and create your first Enterprise JavaBean and client. It doesn't explain what Enterprise JavaBeans are, or how they are used; there are a number of good introductory articles on Sun's JavaSoft Web site. Although the description is based on the use of a Linux server, most of the issues discussed in this article will also apply to other platforms. If you are using a Windows platform you will need to pay attention to the directory names, which will be different from the one's I've assumed.

About JBoss

JBoss is an implementation of the EJB 1.1 (and parts of 2.0) specification, that is, it is a server and container for Enterprise JavaBeans. In this it is similar to Sun's 'J2SDK Enterprise Edition' (J2EE), but the JBoss core server provides only an EJB server. The JBoss core does not include a web container for servlets/JSP pages, although there are bundles available that include either Tomcat or Jetty. The minimal core offering means that JBoss has minimal memory and disk space requirements. JBoss will run very effectively on a machine with 64 megabytes of RAM, and requires only a few megabytes of disk (including source code!). Sun's J2EE requires a minimum of 128 megabytes of RAM, and 31 megabytes of disk space. Because of its small memory footprint, JBoss starts up about 10 times faster than J2EE. There is a built-in SQL database server for handling persistent beans, and this starts up automatically with the server (J2EE ships with the CloudScape SQL server, which has to be started separately).

One of the nicest features of JBoss is its support for `hot' deployment. What this means is that deploying a Bean is a simple as copying its JAR file into the deployment directory. If this is done while the Bean is already loaded, JBoss automatically unloads it, then loads the new version. Contrast this with the rigmarole that other J2EE server makes us go through... JBoss is distributed under the LGPL, which means that it's free, even for commercial work, and the LGPL ensures that it remains that way. Id you need support, look at the JBoss website for the various forums. If you want to pay for the support then contact the JBossGroup LLC.

This chapter helps get you started using JBoss by describing step-by-step how a simple EJB can be created, deployed and tested on the JBoss server.


JBoss is written entirely in Java, and requires a Java system compatible with JDK 1.3. This is essential, not optional. Since it is now possible to get Linux JDKs directly from Sun, there's little reason not to upgrade if you're using an earlier version.

You also need to have Ant version 1.4 or latter on your system as this is used to compile and run all of the examples that will be presented in the JBoss documentation. The next section describes how to obtain and install ant if you don't already have it.

It is assumed that you are basically familiar with EJBs (and roughly know, for example, what a 'home interface' is) and know how to use Ant, the xml based build tool available from Apache.