Java, Software Development

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


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


Place jar file in OpenEJB Server.

You ought to modify OPENEJB_HOME\conf\ to change the bind-address to the current machine’s IP address  which is

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


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 (


Start the OpenEJB Server as a stand-alone


Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.

You Might Also Like