Creating EJB projects
You can use wizards to create an EJB module in your Java EE project.
To create a new EJB project:
- In the Java™ EE perspective, select
File | New | Other | EJB Project. The New EJB Project wizard opens.
- In the
Name field, type a name for the EJB 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 will fail.
- In the
Target runtime drop-down list, select the server that you want to target for your development. Or, create a new 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.0 project, select WebSphere® application server V7.0 or WebSphere application server V6.1 with the feature Pack for EJB 3.0 installed.
Note: If your workspace contains any EAR projects, the name of this EAR may 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 will refresh. If you create a new EAR by typing a new name in the
EAR Project Name field, then the
Target runtime field is enabled and you can choose a target runtime.
- Optional:
Select a pre-defined project configuration from the
Configurations drop-down list.
- Optional:
Modify Configuration, especially for Entity Bean creation: If you want to modify the configuration details, click
modify:
If you plan to create JPA entities in the EJB 3.0 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.0 projects that are subsequently created.
- Optional:
Select the
Add project to an EAR module check box 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.
- In the
Source Folder field, specify a folder for your source files or accept the default value.
- Optional:
Select
Create an EJB Client JAR module to hold the client interfaces and classes if you want the client interface classes for your enterprise beans to be kept in a separate EJB client JAR file. This EJB client JAR file will be 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.
- Optional:
Select
Generate Deployment Descriptor if you want to create a deployment descriptor, although the deployment descriptor is not required in EJB 3.0. The deployment descriptor stores information relating to the EJB project in an Extensible Markup Language (XML) file, serving three functions:
You can add a deployment descriptor later, if you do not add it during the project creation. For information on adding a deployment descriptor file, see Generating deployment descriptors.
- 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
- Click Finish.
Related concepts
Developing EJB 3.0 Applications
Differences between EJB 3.0 and EJB 2.1
Securing enterprise applications
Deploying EJB 3.0 applications