Creating Deployable jar File [Diagram]
- Make the directory that contains the bean files you will be deploying current. To execute the deploytool program, enter deploytool at the prompt and hit return.
- The main Application Deployment Tool window appears. Notice the three major panels: the Server Applications panel showing that there are no applications running;
the Local Applications panel; and the Inspecting panel that will be used while building applications. These panels will be updated when applications are built and deployed. Click on the File menu to continue.
- Select "New Application…" .
- Selecting New Application allows you to specify the application and the .ear file it will be stored in. Applications are stored in a file with the .ear extension.
- In the New Application popup window, enter the name of the application by clicking in the Application Name field (HelloApp in this example).
Enter the location of the file by clicking in the Location field (HelloApp.ear in this example). Click on the OK button when you have entered the names.
- The HelloApp application is shown in the Local Applications panel. The Inspecting panel shows a number of tabbed boxes that will become relevant in due course.
For now, you can just ignore this information. Click the File menu to continue.
-
Select "New Enterprise Bean…" from the File menu.
- Selecting "New Enterprise Bean…" starts the New Enterprise Bean Wizard. This allows you to enter in the information about the EJB.
-
The New Enterprise Bean Wizard displays its introduction page as shown. General instructions are displayed. Click on Next > to go to the EJB Jar window.
- Click in the Display name: field.
- Enter HelloEJB in the Display name: field. Click on the Add… button in the Contents panel.
- In the Add Contents to .Jar dialog box select the Java class files that make up the bean. The files are the remote interface, the bean, the home interface and any other class files that the bean requires.
(The Choose Directory field shows the location of the directory containing these files.) Select the three class files for the Hello bean plus the HelloException class. These classes will be stored in the jar file. For the
purposes of this simulation, click on Hello.class, and we will select the other files for you.
-
Click the Add button.
-
The selected files are now shown in Enterprise Bear JAR classes text box. Click the OK button to continue.
-
The New Enterprise Bean Wizard appears. The Contents text box shows the class files that you added. Click the Next button to continue.
-
The New Enterprise Bean Wizard window header now indicates General. Using the drop down boxes you will select the names of the bean class, the
home interface and the remote interface. The bean class name is already set correctly. Click on the Home interface drop down menu.
-
Click on HelloHome.
-
The Home interface is now set to HelloHome. Click on the Remote interface drop down menu.
-
Click on Hello.
-
The Remote interface is now set to Hello. You now need to add the display name. The display name, Hello, is stored in the deployment descriptor
(DD) and is necessary--don't leave it blank. You could fill in a brief description in the description box but it is not necessary. Note that
the defaults are for stateful session bean. Do not change these. To add the display name, click in the Display name: field.
-
Type "Hello" in the Display name: field.
-
Note the naming conventions used for the Hello bean, Home and Remote interfaces. This convention will be used in all examples. Click the Next
button to continue.
-
The New Enterprise Bean Wizard window header indicates Environment Entries. This window allows you to enter specific information into the DD. For
the purposes of this simulation, you do not need to make any changes in this window. Click the Next > button to continue.
-
The New Enterprise Bean Wizard window header indicates Enterprise Bean References. Again, this window allows you to enter specific information
into the DD. For the purposes of this simulation, you do not need to make any changes in this window. Click the Next > button to continue.
-
The New Enterprise Bean Wizard window header indicates Resource References. Again, this window allows you to enter specific information into the
DD. For the purposes of this simulation, you do not need to make any changes in this window. Click the Next > button to continue.
-
The New Enterprise Bean Wizard window header indicates Security. Again, this window allows you to enter specific information into the DD. For the
purposes of this simulation, you do not need to make any changes in this window. Click the Next > button to continue.
-
The New Enterprise Bean Wizard window header indicates Transaction Management. Again, this window allows you to enter specific information into
the DD. For the purposes of this simulation, you do not need to make any changes in this window. Click the Next > button to continue.
-
The New Enterprise Bean Wizard window header indicates Review Settings. This window shows the contents of the DD. The DD is in XML and
illustrates the composition of the EJB. Click the Finish button to continue.
-
The main Application Deployment Tool window appears. The HelloApp tree now shows the EJB that you created. This ends the simulation.