Packaging A Stateless EJB

  1. The Stateless EJB needs to be packaged in a JAR file. Right click the Calculator project in the Package Explorer View and select the Properties context menu.

  2. Select the Packaging Configurations option:

    Packaging Configurations

  3. At the top of the page there is a check-box labeld Enable Packaging. Check this check-box.

  4. Click the Add... button. Type calculator.jar in the dialog and click the OK button.

    Archive Edition - calculator.jar

  5. You have created a new packaging configuration that will produce the calculator.jar file.

    New Packaging Configuration

  6. We want to add the Stateless EJB class and interface. Eclipse has generated the compiled classes into the bin folder (declared as the default output dir of the project).

    Select the calculator.jar item and right-click in the area to pop-up the menu and choose Add Folder. A Folder Selection dialog appears.

    This dialog allows to select which folder (local to workspace or in the file system) to include into the package, to specify include and exclude filters and to set a prefix that will be append when building the package.

    Folder Selection Dialog

  7. Click on the Project Folder... button. A Folder Chooser dialog appears.

    This dialog allows selecting which folder to include. This folder can be choosen among all the opened projects.

    Select the /Calculator/bin folder and click the OK button.

    Folder Chooser Dialog

  8. The folder is now /Calculator/bin.

    As we only want the EJB class and interface, specify the following as an include filter:


    Click the OK button.

    Include Filter

  9. The packaging configuration for the calculator.jar is now complete.

    Click the OK button to save the packaging configuration.

    Packaging Configuration

  10. Right-click on the Calculator project and select Run Packaging. The packaging will display its output in the console. The output should look like this:

    Buildfile: C:\ejb3workspace\Calculator\packaging-build.xml
          [jar] Building jar: C:\ejb3workspace\Calculator\calculator.jar
    Total time: 875 milliseconds

  11. After the execution, you should have a project that looks like this:

    Project with packaged Session EJB

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine