0

EJB2.0 with OpenEJB: Stateless Session Bean in Action

I am taking SCBCD5.0 certification soon. Right now, I am going over some EJB2.0 materials before taking on EJB3.0. I generally know EJB3.0 but never had grasped the fundamentals of EJB2.0. Mastering EJB2.0 would demystify EJB3.0.

I am writing a two-part blog about an EJB2.0 application running on a stand-alone OpenEJB server which also involves a remote Java client application running on a Linux machine. This is the first part.

Software required (or were used for this blog):

  1. OpenEJB 3.1.4
  2. JDK1.6 Update 21
  3. Eclipse  Ganymede (optional)
  4. VMWare 3.0.1
  5. Ubuntu 10.10 (running as a virtual machine)

Create the interfaces

Create the your session bean

NOTE: In order to successfully build the project in Eclipse, you ought to include javaee-api-5.0-3.jar in the class path.

Create ejb-jar.xml

ejb2

Jar-up the classes and xml file and place the jar file in OpenEJB server.

ejb2-2

Place jar file in OpenEJB Server.

You ought to modify OPENEJB_HOME\conf\ejbd.properties to change the bind address to the current machine’s IP address  which is 192.168.1.2.

NOTE: Your machine’s IP address may not be the same as mine.

open-ejb-ejbd-props

Change bind address to current machines IP address.

Finally, start the OpenEJB Server from the command-line. Our remote Java application will use the EJB deployed in this machine (192.168.1.2).

ejb2-3

Start the OpenEJB Server as a stand-alone

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert