Show TOC

Creating an EJB 3.0 Project and an EAR Project Locate this document in the navigation structure

Procedure

In this step you create the EJB 3.0 project, which provides the framework for the development of the message-driven bean (MDB). Then you add the EJB 3.0 project to an Enterprise Application Archive (EAR).

  1. Open the Developer Studio and specify the workspace.

  2. Create a new project. In the Developer Studio from the menu path choose   File   New   Project  to start the New Project wizard.

  3. Select  EJB   EJB Project  and chooseNext.

    This graphic is explained in the accompanying text.

  4. In the New EJB Project screen you:

    • Specify MyFirstMDB as the name of the project.

    • Select the Add project to an EAR checkbox and enter MDBEar in the EAR Project Name field. This automatically creates the Enterprise Application Archive and adds the EJB 3.0 project to it.

    • Choose New... to adjust the Project Facets in the EAR project. A New EAR Application Project screen appears.

    • Choose Next.

    • Select the Create SAP JMS resources descriptor checkbox in the Project Facet list to add the jms-resources.xml in the EAR project.

    • Choose Finish.

    This graphic is explained in the accompanying text.

  5. Choose Finish.

You have created the EJB 3.0 project MyFirstMDB and the EAR project MDBEar. The structure of your project is currently displayed in the Project Explorer.

The Message Driven Bean

In this tutorial, you also create and implement an MDB, which is a consumer of a message sent by a client residing on the server. There is also an example SimpleSenderClient class, which is the client sending a message to an MDB.

Creating the MDB Application

The process of developing and deploying an MDB application consists of the following steps:

  1. Create an EJB Project.

  2. Develop the enterprise bean (EJB).

  3. Assemble the enterprise application archive (EAR file).

You can choose the type of the sender to be either an internal Java EE client (another EJB, servlet or JSP) or a remote Java client.

Result

You have created the EJB 3.0 project.