Assembling the Calculator Application

Use this procedure to package the Calculator session bean, the CalcProxy JavaBean, and the Calculator JSP in an application archive (EAR file). The EAR file contains the JAR and the WAR files with the application components, as well as deployment descriptors – application.xml and application-j2ee-engine.xml.


You have already created the archive files CalculatorEjb.jar and CalculatorWeb.war.


Creating the Enterprise Application Project


       1.      Choose File ® New ®Project.

       2.      Select J2EE (the left-hand pane) and Enterprise Application Project (the right-hand pane). Choose Next.

       3.      Enter CalculatorEar as the project name and leave the default settings unchanged. Choose Next.

       4.      Select CalculatorEjb and CalculatorWeb as referenced projects. Choose Finish.

The wizard generates the project structure of the new Enterprise Application project.

Defining the Context Root

       5.      Expand the project node and double-click the application.xml.

The deployment descriptor editor appears.

       6.      Choose the Modules tab.

       7.      Select CalculatorWeb.war as a module.

       8.      Change the name of the predefined value in the Context Root field to /Calculator.

The new context root /Calculator  will be used for starting the application.

       9.      Save the editor contents.

Building the EAR file

   10.      In the J2EE Explorer view, select CalculatorEar and open the context menu.

   11.      Choose Project а Rebuild All.

   12.      Choose Build Application Archive.

The system displays a message to inform you that the build has been successful.

   13.      Close the screen by choosing Ok.


The Enterprise archive file CalculatorEar.ear has been generated. It contains all the EJB classes and all Web resources, along with the deployment descriptors from the Enterprise Application project.

Next step:

You can deploy the application on SAP J2EE Engine.