CS6320:  SW Engineering of Web Based Systems

 

Creating EJB using Eclipse (with GlassFish pluggin) -- Creating a Enterprise Application Project

 

 

see http://www.webagesolutions.com/knowledgebase/javakb/jkb005/index.html

 

and http://www.myeclipseide.com/documentation/quickstarts/earprojects/

 

EAR composition

 

1) Create Enterprise Application Project (will include EJB)

 

File->New -> Enterprise Application Project

 

Click on the NEXT and on following screen choose "New Module"

new module

CHOOSE only the modules you want to create (EJB, client, Webapp, connector)

new module

 

Select the modules you just created and Hit Finish

finihs

 

The results (I did 4 modules) is a new project in Eclipse for each module-- I have one for EJB, Webapp,

4 projects created

 

 

<< 4 Projects created Test_Eclispe_GlassFish_EAR_*

 

 

 

 

 

2) Configure the Test*_EAR_ProjectWeb project so that the EE Web Application will include the EJB project code we setup in step 1

Right Click on Test*_EAR_ProjectWeb -> properties

web properties

 

 

<<<< Select "ADD"

 

 

 

 

 

 

 

 

 

 

 

 

You will get

next

 

 

 

 

 

<<<Select Project and hit Next

 

 

 

 

 

 

You will get the following, SELECT the EJB project created in step 1, then Click FINISH

 

 

 

 

<< The result is that the deployment assembly points to EJB project

 

 

 

 

 

 

 

 

 

 

 

 

 

Creates a Top "Test*_EAR_Project" project that integrates the different components of this Enterprise Application Project

Test_ProjectEAR

<<This new project has the 4 modules in it

 

 

 

 

 

 

3)Lets create a new EJB in my Test_Eclipse_GlassFish_EAR_ProjectEJB created in step 1

 

Example going to create a new EJB Session class called MySessionEBJ

Right Click on EJB project folder -> New -> Other->EJB->Session Bean

new ejb

Fill in information about your EJB Session bean

ejb name

 

Here is the result of adding this Session Bean to the Project...NOTE IT SHOWS UP UNDER SESSION BEANS

Also, added business method to sayHello()

 

ejb added

 

 

© Lynne Grewe