You can use wizards to create
an EJB module in your Java™ EE
project.
Procedure
- In the Java EE perspective,
right-click your enterprise application project and select . 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 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.
- Optional: Select a pre-defined project configuration
from the Configurations drop-down list.
- Optional: Modify Configuration: If you
want to modify the configuration details, click modify:
If you are creating
a entity, for example, select Java Persistence. Save this configuration with a meaningful name, for example, EJBDevelopmentWithEntityBeans so that you can reference
this configuration in any EJB 3.1 projects that are subsequently created.
- 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.
- Click Next.
- In the Source Folder field, specify
a folder for your source files or accept the default value (ejbModule).
- In the Output Folder field, specify
a folder for your output files or accept the default value (build\classes).
- 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.
- 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.
- Click Finish.