EJB Deployment   «Prev 

Creating Deployable jar File [Diagram]

  1. 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.
  2. 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.
  3. Select "New Application…" .
  4. 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.
  5. 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.
  6. 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.
  7. Select "New Enterprise Bean…" from the File menu.
  8. Selecting "New Enterprise Bean…" starts the New Enterprise Bean Wizard. This allows you to enter in the information about the EJB.
  9. 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.
  10. Click in the Display name: field.
  11. Enter HelloEJB in the Display name: field. Click on the Add… button in the Contents panel.
  12. 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.
  13. Click the Add button.
  14. The selected files are now shown in Enterprise Bear JAR classes text box. Click the OK button to continue.
  15. The New Enterprise Bean Wizard appears. The Contents text box shows the class files that you added. Click the Next button to continue.
  16. 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.
  17. Click on HelloHome.
  18. The Home interface is now set to HelloHome. Click on the Remote interface drop down menu.
  19. Click on Hello.
  20. 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.
  21. Type "Hello" in the Display name: field.
  22. 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.
  23. 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.
  24. 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.
  25. 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.
  26. 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.
  27. 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.
  28. 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.
  29. The main Application Deployment Tool window appears. The HelloApp tree now shows the EJB that you created. This ends the simulation.