6.7.1: Application assembly tutorial
During this tutorial, you will assemble a J2EE application .ear file from
an EJB JAR file, some Web application components, and a Java application client JAR file.
Assembly is a prerequisite to deploying your application on the application server. Put
simply, assembly involves identifying the various code artifacts as a single unit
(application), and configuring the deployment descriptor of the application.
The application used for this tutorial is a Session bean application, but the
assembly steps are similar for a BMP bean application. For information about
CMP bean applications, see the Advanced tutorial,
which assumes knowledge of this assembly tutorial and others.
Prerequisites
There are no prerequisites for performing this tutorial.
Overview of steps (requires 30 to 50 minutes)
- Obtain the tutorial application
- Start the Application Assembly Tool
- Assemble an EJB module, converting EJB 1.0 JAR to EJB 1.1
- Assemble a Web module
- Assemble an application client module
- Assemble a J2EE application
- Generate code for deployment
- Exit the Application Assembly Tool
Paths through the tutorial
- Quick path: If your objective is
to practice these steps as quickly as possible, skip the
explanations marked with the
graphic.
- Maximum learning path: If your objective is to understand and explore the
product capabilities, read the
notes and browse the links
they provide to additional documentation.
- Create a directory named "tutorial" under the path:
product_installation_root/temp
- Click here to access the .zip file containing the tutorial application components.
- Save the .zip file to
product_installation_root/temp/tutorial
- Use your favorite .zip or .jar utility to extract the tutorial.zip content into
the tutorial directory.
Start the Application Assembly Tool (AAT) by:
- Open a system command prompt.
- Change directory to product_installation_root/bin
- Type assembly.
If
using Windows NT or 2000, and you do not see the graphical
interface of the tool right away, check for the minimized tool
on the Task Bar.
- Click Cancel at the Welcome to Application Assembly Tool
panel.
-
Load the EJB jar file into the tool:
-
Click File -> Open.
-
Navigate to the SimpleSessionEjb10.jar and select open.
-
Click OK at the "... please specify the dependent classpath
..." dialog.
-
[Optional] Edit the deployment descriptor.
-
Select the jar (the top entry in the assembly tool tree view) and click it to display its properties.
-
Enter the following:
-
Display Name: EJB11
-
Click Apply
-
Save your changes using File->Save As. Save the file as Ejb11.jar
in the path:
product_installation_root/temp/tutorial/assembly/Ejb11.jar
You now have a view of the EJB module in the Application Assembly Tool tree view.
-
Create a new .war file by clicking File -> Wizards
-> Create Web Module Wizard.
-
On the Specifying Web Module Properties panel, enter the following:
-
Display Name: SimpleSessionWar
-
File Name: simpleSession.war
-
Click Next.
-
Click Add Class Files... on the Adding Files panel:
-
Select Browse
-
Navigate to the servlet.jar file, highlight the file and click Select.
-
Select the com folder (in the right hand pane).

-
Click Add to display the files (in the com folder) in the lower part of the dialog.

-
Click OK.
-
Click Next.
-
Click Next on the Specifying Optional Web Module Properties
settings panel.
-
Click Next on the Choosing Web Module Icons settings panel.
-
Click New... on the Adding Web Components panel to start
the Create Web Component Wizard:
-
On the Specifying Web Component Properties panel:
-
Enter the Component Name: SimpleServlet
-
Select Next.
-
On the Specifying Web Component Type panel:
-
Set the Component Type to Servlet.
-
Click Browse.
-
Expand the tree view as far as it will go and select servlets.
-
Select SimpleSessionServlet.class in the right pane.
-
Click OK.
-
Click Next
-
Click Next on the Choosing Web Components Icon panel.
-
Click Next on the Adding Security Role References panel.
-
Click Finish on the Adding Initialization Parameters panel. This
will return you to the Create Web Module wizard.
-
Click Next.
-
Click Next on the Adding Security Roles panel.
-
Click Add on the Adding Servlet Mappings panel.
-
Specify a URL Pattern: /SimpleSession
-
Ensure that SimpleServlet is selected as the Servlet.
-
Click OK.
-
Click Next.
-
Click Next at the Adding Resource References panel.
-
Click Next at the Adding Context Parameters panel.
-
Click Next at the Adding Error Pages panel.
-
Click Next at the Adding MIME Mappings panel.
-
Click Next at the Adding Tag Libraries panel.
-
Click Next at the Adding Welcome Files panel.
-
Click Add at the Adding EJB References panel:
-
Enter the following:
-
Name: ejb/ABean
-
Home: com.ibm.websphere.gettingstarted.ejbs.SimpleSessionHome
-
Remote: com.ibm.websphere.gettingstarted.ejbs.SimpleSession
- Ensure Session is selected as the Type.
-
Click OK.
-
Click Finish. The Web module is displayed in the assembly tool interface.
-
Save the .war file using File -> Save As. Name the file simpleSession.war.
- Create a new application client using File -> Wizards
->
Create Application Client Wizard.
-
On the Specifying Application Client Module Properties panel, enter
the following:
-
Display Name: SimpleSessionClient
-
File Name: simpleApp.jar
-
Click Next.
-
Click Add... on the Adding Files panel.
-
Select Browse.
-
Navigate to the client.jar file, highlight the file and click Select.
-
Select the com folder (in the right hand pane).
-
Click Add.
-
Click OK.
-
Click Next.
-
On the Specifying Additional Application Client Modules Properties
panel:
-
Enter Ejb11.jar for Classpath.
-
Select Browse next to Main Class field.
-
Expand the tree view in the left pane as far as it goes and select
clients.
-
Select SimpleSessionClient.class in the right panel.
-
Click OK.
-
Click Next.
-
Click Next on the Choosing Application Client ModulesIcons
panel.
-
Clcik Add on the Adding EJB References panel.
-
Enter the following:
-
Name: ejb/SimpleSession
-
Home: com.ibm.websphere.gettingstarted.ejbs.SimpleSessionHome
-
Remote: com.ibm.websphere.gettingstarted.ejbs.SimpleSession
-
Click OK.
-
Verify that your EJB reference is displayed in the EJB References list.
-
Click Next.
-
Click Next on the Adding Resource References panel.
-
Click the Finish on the Specifying Environment Entries panel. The
application client module is displayed in the Application Assembly Tool.
-
Save the application client jar file by clicking File -> Save As.
Name it simpleApp.jar.
-
Using AAT, create an .ear by clicking File -> Wizards -> Create Application
Wizard.
-
On the Specifying Application Properties panel:
-
Enter the following:
-
Display Name: SimpleSessionApp
-
File Name: simpleSession.ear
-
Click Next
-
Click Next on the Adding Supplementary Files panel.
-
Click Next on the Choosing Application Icons panel.
-
Click Add... on the Adding EJB Modules panel.
-
Navigate to your Ejb11.jar file, highlight the file and click Open.
-
Click OK on the resulting Confirm values dialog.
The EJB module is now listed on the Adding EJB Modules panel.
-
Click Next.
-
Click Add... on the Adding Web Modules panel.
-
Navigate to your simpleSession.war file, highlight the file and
click Open.
-
In the resulting dialog, enter a Context Root: /gettingstarted3
-
Click OK.
The Web module is now listed on the Adding Web Modules panel.
-
Click Next.
-
Click Add... on the Adding Application Client Modules panel.
-
Navigate to your simpleApp.jar file, highlight the file and click
Open.
-
Click OK on the resulting dialog.
The application client module is now listed on the Adding Application Client Modules file.
-
Click Next.
-
Click Finish on the Adding Security Roles panel.
The application is now displayed in the Application Assembly Tool.
-
Bind the EJB and references to it:
-
In the assembly tool tree view, expand EJB Modules -> EJB11 -> Session Beans
-> com_ibm...ejbs_SimpleSession.
-
Click it to display its properties.
-
Select the Bindings tab.
-
Replace the existing text string with gs/hello as the global
JNDI name of the session bean.
Although this example uses a short name for the session bean, consider
using longer names in actual practice. A long name will help ensure that
the name is unique in the global name space. An example of a suitable long
name is:
com/ibm/websphere/gettingstarted/ejbs/SimpleSessionHome
-
Click Apply.
-
Bind the EJB reference (java:comp/env/ejb/ABean) to the global JNDI name
of the bean:
-
Expand Web Modules -> SimpleSessionWar.
-
Select EJB References.
-
Select in the right pane the particular reference called ejb/ABean.
-
Select the Bindings tab.
-
Replace the existing text string with gs/hello.
This
is the JNDI Name that you assigned to the enterprise bean in an earlier
step.
-
Click Apply.
-
Bind the EJB reference:
-
Expand Application Clients -> SimpleSessionClient.
-
Select EJB References.
-
Select in the right pane the particular reference to your session bean:
ejb/SimpleSession
-
Select the Bindings tab.
-
Replace the existing text string with gs/hello. This
is the JNDI Name that you assigned to the enterprise bean in an earlier
step.
-
Click Apply.
-
Save the .ear file by clicking File -> Save As. Name it simpleSession.ear.
-
Right-click the .ear file by selecting the top entry in the tree view of the assembly tool.
-
Select Generate Code for Deployment.
-
Select appropriate Database Type.
-
Click Generate Now.
-
When deployment is complete, close this window.
Another way to generate code for deployment is to use the
Deployment Tool directly. The Application
Assembly Tool calls the command line Deployment Tool for you when
you use the Generate Now button and accompanying dialog.
Exit the assembly tool using the File -> Exit
option.
What's next?
Now that you have your application assembled, you can deploy it on the application
server, which includes "installing" it. The next steps are outlined by the
Application deployment tutorial.