Creating EJB projects

You can use wizards to create an EJB module in your Java™ EE project.

Procedure

  1. In the Java EE perspective, select File > New > Other > EJB Project or Web Project. The New EJB Project or new Web project wizard opens.
  2. In the Name field, type a name for your project. To change the default Project location, click the Browse button to select a new location. If you specify a non-default project location that is already being used by another project, the project creation fails.
  3. In the Target runtime drop-down list, select the server that you want to target for your development. Or, create a target runtime environment by clicking New. The target runtime selection affects the compilation and runtime settings by modifying the class path entries for the project. To create an EJB 3.1 project, select WebSphere® application server V7.0, V8.0, or v8.5.
    Note: If your workspace contains any EAR projects, the name of this EAR might appear in the EAR membership field at the bottom of the page, because the tools reference an existing EAR by default. In this case, the Target runtime field appears disabled, because its value reflects the target runtime of the EAR that appears by default. If you select another existing EAR in the EAR Project Name field, the target runtime refreshes. If you create an EAR by typing a name in the EAR Project Name field, then the Target runtime field is enabled and you can choose a target runtime.
  4. Optional: Select a pre-defined project configuration from the Configurations drop-down list.
  5. Optional: Modify Configuration, especially for Entity Bean creation: If you want to modify the configuration details, click modify:

    Modify configuration

    If you plan to create JPA entities in the EJB 3.1 project, for example, select Java Persistence. Save this configuration with a meaningful name, for example, EJBDevelopmentWithJPA so that you can reference this configuration in any EJB 3.1 projects that are subsequently created.

  6. Optional: Select Add project to an EAR module to add the new module to an enterprise module (EAR) project. Type a new project name or select an existing enterprise module project from the drop-down list in the EAR Project Name combination box. Or, click New to launch the New EAR module Project wizard.
  7. In the Source Folder field, specify a folder for your source files or accept the default value.
  8. In the Output Folder: field, specify a folder for your output files or accept the default value (ejbModule).
  9. Optional: If in the previous page, you selected Add project to an EAR module, then you are able to create an EJB Client Jar. Select Create an EJB Client JAR module to hold the client interfaces and classes if you want the client interface and classes for your enterprise beans to be kept in a separate EJB client JAR file. This EJB client JAR file is added to the enterprise module as a project utility JAR file. Specify values for the Name and Client JAR URI fields, or accept the defaults. If you select this option, the Deployment Descriptor will be generated by default.
  10. Optional: Select Generate Deployment Descriptor if you want to create a deployment descriptor, although the deployment descriptor is optional in EJB 3.0 and above. The deployment descriptor stores information relating to the EJB project in an Extensible Markup Language (XML) file, serving three functions:
    • Declaring the contents of the module
    • Defining the structure and external dependencies of the beans in the module
    • Describing how the enterprise beans are to be used at run time
    You can also add a deployment descriptor to your EJB module later. See Generating deployment descriptors.
  11. Click Finish.

Feedback