EJB Deployment   «Prev  Next»

Lesson 6 Deploy the bean
Objective Deploy the bean in the container.

Deploy EJB Bean in Container

In this lesson, the deployable jar file will be passed to the deploytool and then loaded into the J2EE platform.
The platform will examine the classes and build the home object, EJBObject, stubs, and skeletons.
The JNDI entry will be created and registered at this time.
If you have any trouble with these principles, please review the lesson EJB clients, servers, containers, and beans earlier in this course.

J2EE overview

The J2EE reference implementation is composed of two major programs:
Name Description
deploytool The deployer program
j2ee The J2EE platform (server, container and JNDI)

The Diagram below illustrates the interaction between these two. Closely examine the activities and sequence of each step.
Deployment Tool and J2EE platform
Deployment Tool and J2EE platform
  1. The HelloApp.ear file is extracted from the application file and is imported into the deploytool.
  2. The deploytool allows the deployer to enter or change local environment information in the DD.
  3. The deploytool passes the HelloEJB.jar, including the updated DD, to the J2EE platform.
  4. J2EE creates the application jar file (Hello.jar), then creates and compiles the home, remote, stubs, skeletons classes, etc. and stores them in its repository.
  5. The name and remote reference class for the Hello bean is placed in the JNDI directory.
  6. J2EE informs the deploytool that the EJB is deployed.
  7. The deploytool returns a jar file containing the stubs and skeletons for the client.

EJB deploy Tool jar

Client stubs and skeletons

The J2EE implementation provides the client with stubs and skeletons in a jar file that is created by the J2EE at deployment time. In the reference implementation, the client downloads only a small remote reference class to the home object from JNDI at lookup() time.
This class, which is a proxy for the remote object, invokes the stub when connecting to the bean's home object.
The client loads the stub from this jar file at run time. The name of the file for the Hello bean is HelloAppClient.jar.

Starting the programs

The deploytool and the J2EE platform must be executing in order to deploy the bean. They are started in different windows, as they run concurrently and communicate over the network.
The statements to execute the J2EE platform are:
j2ee -verbose
And to start the deployment tool:
deploytool

You must have networking, including DNS, fully installed and running on your system before executing these programs.
If you need help with this step please see your System Administrator. None of these programs will work without it.

Interacting with Deploytool

The following simulation illustrates the steps in deploying an application that uses the Hello bean. J2EE allows one or more beans to be combined into an application. In this case, only the Hello bean will be used. The name of the application, HelloApp, is specified at deployment time as shown in the simulation.
Deploy Hello Bean

Deploy Bean - Exercise

Click the Exercise link below to deploy the Hello bean in the J2EE platform.
Deploy Bean - Exercise