ObjectWeb Logo

Creating an EJB Project


Open New Project Wizard.

New Project Wizard

User Interface:

  Right click in the Package Explorer View.
  Select:	New > Project
  Select:	EJB > EJB Project
  Click:	Next

Description:

This selection will cause WTP to create a project capable of holding EJB's. These types of projects can be packaged and deployed in a EJBJAR file or in an EAR file.

Create New EJB Project.

New EJB Project

User Interface:

  Enter:	Project name:
  Select:	Target runtime: (from pull down list)
  Check:	Add project to an EAR and provide EAR Project Name: (Optional)
  Click:	Next

Description:

This dialog allows you to name the project and specify where in the file system the project should be created. You also have the ability in this dialog to specify that the project should be packaged for deployment in an EAR file. If this is not specified then the project will be deployed in an EJBJAR file.

Description of fields:

Project name:
Enter the name you want the project known by in this text box. It is strongly recommended that you avoid using spaces in this name as that can cause problems on some platforms.

Project Contents:
If you uncheck the Use default checkbox, then you can supply the location in the file system where you want this project to exist. The default location will be in the Eclipse workspace, under a directory name that matches the project name.

Target Runtime:
Select the WTP Server Runtime which will be used when this project is deployed. Selection of a server here only adds the JRE and the servers J2EE Jar files to the build classpath for this new project. It does not prevent the project from being deployed at a later time to other servers defined within WTP.

If there are no entries in the pull down list then you must create a server runtime to which this project can be associated. This can be accomplished by clicking on the New button to the right of this field.

EAR Project Name:
If you check the Add project to an EAR checkbox, you can then enter the name of an EAR project in this text box. This will cause WTP to package the EJB Project in the specified EAR file for deployment when being published to a server. If an EAR project by the name entered in this text box does not exist then it will be created. If this option is not selected then this project will be packaged in an EJBJAR file for deployment.

Select Project Facets.

Select Project Facets

User Interface:

  Check:	EJBDoclet (XDoclet)
  Click:	Next

Description:

This dialog lets you choose which facets should be used with your project. A facet represents a collection of functionallity and when selected may enable builders to be run when the project is built. In this case a builder will be used to create server specific content (both extra files and extra data within existing files) in the project.
If you had selected the JOnAS Runtime 4.6 target runtime in the previous dialog box, the JOnAS Facet should appear and automatically be checked. Also selecting the EjbDoclet facet causes the Jonas EjbDoclet tasks to be run when the project is built. These tasks create the JOnAS server specific deployment descriptors needed to publish this project to the JOnAS server.

Specify Ejb Module Parameters.

Ejb Module

User Interface:

  Uncheck:	Create an EJB Client JAR module to hold the client interfaces and classes
  Click:	Finish

Description:

This dialog allows you to change the source folder used when EJB's are created within this project. You can also choose if there should be a separate EJB Client project created and associated with this project.

Description of fields:

Source Folder:
This controls where the EJB source files will be kept in this project. There may be references elsewhere in this document to ejbModule which is the default value for this field. If you change this value then where you see those references, you will need to replace ejbModule with the value you entered here.

Create an EJB Client JAR module to hold the client interfaces and classes
This checkbox should not be checked if you plan to deploy the project to JOnAS.
When this option is checked (and the project is associated with an EAR project) you will have problems trying to deploy the project to JOnAS. We hope to resolve this problem in a future version of this product.

Name:
This field is only available when the EJB Client JAR checkbox has been selected.

Client JAR URI:
This field is only available when the EJB Client JAR checkbox has been selected.


Update the EjbDoclet (XDoclet) Project Properties.

Update XDoclet Properties

User Interface:

  Right click on the EJB Project in the Package Explorer View.
  Select:	Properties
  Select:	XDoclet
  Uncheck:	Use global xdoclet preferences
  Enter:	XDoclet Home: (if missing or incorrect)
  Enter:	Version: (if missing or incorrect)

Description:

This dialog controls the XDoclet builder that can be run when this project is built. It also is used to tell Eclipse where XDoclet has been installed on your system.

Description of fields:

XDoclet Home:
This field should point to the XDoclet installation on your system. In the folder this points to you should find folders named docs, lib, and samples.

Version:
This must identify the version of XDoclet installed on your system.

Update Ejb Doclet Properties

User Interface:

  Select:	XDoclet > ejbdoclet
  Check:	JOnAS Wtp Adapter
  Select:	JOnAS Wtp Adapter
  Click:	Edit

Description:

This dialog controls which tasks should be run during the EjbDoclet phase of the project build. It is during the execution of these tasks that the server specific deployment descriptors (and other things) get created.

Update Ejb Doclet Properties

User Interface:

  Set:		Version to 4.6 (if missing or incorrect)
  Click:	Finish
  Click:	OK (to exit the properties dialog)

Description:

This dialog provides an interface to allow the user to edit some of the XDoclet properties associated with the JOnAS EjbDoclet tasks. These tasks are run during the build of the project. The JOnAS Xdoclet Jar file delivered with this package includes version 4.6 of the JOnAS EJBDoclet tasks. If you are using a different Xdoclet Jar file, then the version field may need to be changed to match the version you are using. The other fields in this dialog should probably not be changed.

Description of fields:

version
This field identifies the version of the EjbDoclet tasks to be used during the project build. Its value should be set to 4.6 if you are using the JOnAS XDoclet JAR file delivered with this package. If you are using a different JAR file (we have not seen another one that works correctly) then this version must match the version of the tasks in that JAR file.

all other fields
Values in all other fields in this dialog should probably remain unchanged.


Create an Xdoclet EJB in an EJB Project.

Create an Xdoclet EJB (step 1)

User Interface:

  Right click on the EJB Project in the Package Explorer View.
  Select:	New > Other
  Select:	EJB > XDoclet Enterprise JavaBean
  Click:	Next

Description:

This dialog tells Eclipse to start the wizard that will create a new XDoclet EJB.

Create an Xdoclet EJB (step 2)

User Interface:

  Select button to specify type of Enterprise bean to create.
  Click:	Next

Description:

This dialog tells Eclipse that the EJB to be created should be either a Session bean or a Message Driven bean.

Create an Xdoclet EJB (step 3)

User Interface:

  Enter:	Java package:
  Enter:	Class name: (or use default value)
  Click:	Next

Description:

This dialog provides a way to specify which project and where in the project the new EJB should be created.

Description of fields:

Project:
Must be set to the name of an EJB project that is to contain the new EJB being created. If the desired project was selected before the new EJB wizard was started, then its name should already be present in this field. If it was not selected, Eclipse will try to pick an EJB project from your workspace but it may not be the one you want so you may have to change it.

Folder:
Must be set to the source folder name of the EJB project that is to contain the new EJB being created. This will have the form of <project name>/<source folder name>. If the desired project was selected before the new EJB wizard was started, then its source folder name should already be present in this field. If it was not selected, Eclipse will try to pick an EJB project from your workspace and put its source folder in this field. If it picked a different project than where you wanted the EJB, you will need to change this field to point at the desired projects source folder.

Java package:
This specifies the package name used by the EBJ. These values typically start with a lower case character and should be a qualified name that makes them unique to your organization (eg: org.objectweb.xyz).

Class name:
This specifies the Java Class that will be generated to implement the EJB. The value entered here will also be offered as the default value for the EJB Name, JNDI Name, and Display Name in the next dialog.

Superclass:
The use of this field is unknown at this time. I tried selecting a value for this field and could not find it used anywhere in the generated EJB. I would suggest leaving the default value in the dialog.

Create an Xdoclet EJB (step 4)

User Interface:

  Change values of fields (Optional).
  Click:	Next

Description:

This dialog allows you to specify EJB attributes that control how to access the EJB as well as how the EJB manages state and handles transactions.

Description of fields:

EJB Name
The name to be used to identify this EJB in the deployment descriptors used by application servers when this EJB is loaded. By default WTP will offer the class name value specified in the previous dialog.

JNDI Name
The name to be used with the Java Naming and Directory Interface (JNDI) to locate this EJB. By default WTP will offer the class name value specified in the previous dialog.

Display Name
A name which can be used to identify this EJB in display output. This value will appear in the ejb-jar.xml file but does not appear to be used at runtime.

Description
A breif description of the services provided by the EJB. This value will appear in the ejb-jar.xml file but does not appear to be used at runtime.

State Type (for Session EJB's only)
This value tells the EJB container if the state of the EJB needs to be preserved across invocations by a remote user. The choices available in the pull down list are stateless and stateful.

Destination (for Message Driven EJB's only)
This value tells the EJB container what type of message interface the EBJ will use as its interface. The choices available in the pull down list are queue and topic.

Transaction Type
This value tells the EBJ container how to manage transactions processed by the service. The choices available from the pull down list are container and bean.

Create an Xdoclet EJB (step 5)

User Interface:

  Click:	Finish

Description:

This dialog provides you with some control of the code to be generated when the EJB is created.