For the purposes of this chapter we must define several concepts as they relate to Enterprise
JavaBeans. Each of these pieces has a specific role that is defined by the EJB specification,
which lays out very precisely the responsibilities of each and how they interact with each
other. These components are as follows:
• EJBs —The server-side objects containing your business logic. This is where you will do
all of your work to define the functionality of the system.
• Application Server —Provides the deployment tools necessary to deploy the EJBs, as
well as runtime support for the deployed EJBs. The interaction between application
server and EJB is important, and we will discuss how the application server manages the
lifecycle of each EJB instance.
• EJB Client —The client to an EJB is the software that is accessing and making method
invocations to the EJB, either through its home or remote interfaces, both of which will
be discussed later. The EJB client can be an applet, a servlet, or any code, including any
All of these pieces must work flawlessly together for an EJB system to accomplish its goals.
As mentioned before, all of the interactions between these pieces are defined in the specifica-
tion, and this contractual agreement is what enables an EJB application to be easily deployed
on different systems.
Before we get started developing our example, you need to download and install an EJB con-
tainer. For our examples we are going to be using Allaire's JRun. Installing and configuring
JRun is very simple. The first thing to do is to download the product from Allaire. This can be
You will download an executable that will install the program. The first thing that you will do
during installation is to accept the licensing agreement. The setup program will then ask you
for a serial number; you should leave this blank. By leaving the serial number blank you will
gain access to a developer's license for the product. This license is a full working version of
the application server, but it only allows three simultaneous connections.
After this, accept all of the default entries for the installation of JRun. After the product installs
you will be guided through the configuration of the Admin server for JRun. Choose a password
for the admin account that you will remember. You should also write down the port that is cho-
sen for the Admin server. You will need both pieces of information to access the Admin server
to deploy your EJBs.
Now you are ready to deploy and test your Enterprise JavaBeans.