How to create an EJB3 application

From Wiki

Jump to: navigation, search

Contents

Installing the development environment

  1. Install JBoss Application Server.
  2. Install your development environment. Use Eclipse and JBoss Tools.

Create a new EJB3 project

New EJB Project
New EJB Project


  1. Open Eclipse
  2. Choose File > New > Project... (the project wizard)
  3. Retrieve the EJB wizard from the list of choices you have


Name Your Project

Name your project
Name your project


  1. Choose a name for your project (complete the Project name field)
  2. Optional, using Project Contents area, you can specify the folder of your project in the workspace. However it is obvious that the folder name is the project name.
  3. Optional, in the Target Runtime area you may to specify the JEE runtime you want to use for your project. Push the button New and choose the the JBoss 5.0 runtime configuration. This will allow to deploy automatically your application to the Application Server from the Eclipse IDE (By default J2EE Runtime Library is considered).
  4. In the Configurations area use Default Configuration (do not change nothing)
  5. Optional, if you want to add this project to an existent EAR file, you have to check the Add Project to an EAR checkbox from EAR Membership area.
  6. Press Next.

Configure Your Project

Configure EJB and Java
Configure EJB and Java


  1. Add Project facet EJBModule in version 3.0.
  2. Add Java facet in version 6.0 (5.0).
  3. Do not add EJBDoclet and Java Persistence facets.
  4. Press Next.

Choose the project source folder name

Source folder name
Source folder name
Project Ready
Project Ready
  1. Optional, you can change the default name for the source folder (ejbModule) as you wish (may be src).
  2. Optional, you can generate a deployment descriptor XML file by checking the Generate Deployment Descriptor checkbox.
  3. Press Finish.Now the project is ready.



Create a JBoss AS inside Eclipse IDE

Define New Server
Define New Server


  1. Create a server on which Eclipse deploy your application. You must select the tab Servers from the right-down area of Eclipse IDE screen. Right-click your mouse and choose New > Server.
  2. Choose the JBoss server version you had previously installed.
  3. Choose the Server Runtime by pressing Installed Runtimes button.
  4. Press Next.
  5. The next window appearing is about login credentials to your server. For a default (for development) installation you don't have to configure nothing.
  6. Press Next.
  7. The new appearing window is about the projects you want to add to the server. Press Add or Add all accordingly.
  8. Press Finish. Now you have your server configured.
Personal tools