16.10.2015 Views

Getting Started with WebSphere Application Server

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

92 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> Community Edition<br />

}<br />

public void sayHello() {<br />

}<br />

System.out.println("Hello!");<br />

Listing 5.4 - Implementing the EJB class<br />

In the listing, we implement the only method sayHello() in HelloEJB. This EJB has<br />

been completed.<br />

5.2.2 Deploying an EJB<br />

To deploy an EJB you need to:<br />

1. Create a deployment plan for the EJB<br />

2. Package the EJB<br />

3. Deploy the EJB<br />

5.2.2.1 Creating a deployment plan for the EJB<br />

Just in the same way a servlet included in a Web project is accompanied <strong>with</strong> a<br />

deployment plan named geronimo-web.xml, for an EJB project in Community Edition<br />

the deployment plan is called openejb-jar.xml which is placed in the META-INF<br />

directory. All the dependencies should be declared in the deployment plan.<br />

In Community Edition, every deployable artifact must have a unique configuration id. A<br />

Configuration id is a combination of a group id, artifact id, and artifact version and artifact<br />

type. A Configuration id is defined in the deployment plan. As a deployable artifact, the EJB<br />

also needs to define a configuration id in its deployment plan stored in openejbjar.xml.<br />

Other resources or dependent artifacts can also be stated in the deployment<br />

plan. More details about an EJB deployment plan can be found in the deployment section<br />

of the Community Edition user guide at<br />

http://publib.boulder.ibm.com/wasce/V2.1.1/en/developing-deployment-plans.html<br />

To deploy EJBs, developers need to add an EJB namespace in the deployment plan.<br />

Listing 5.5 provides a simple example of an EJB deployment plan; it only defines the<br />

configuration id of the EJB.<br />

<br />

<br />

<br />

<br />

com.ibm.wasce.start<br />

testejb<br />

1.0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!