EJB 3 Hello World JBoss

EJB 3 Hello World JBoss

In this demo you will see how to create simple EJB 3 where we will print Hello World on console. Please follow below steps:

Below are needed:

  • JBoss Application Server 5.1 community version
  • Eclipse 3.3 or up (For this demo we have used Kepler)

Steps:

  • Create EJB project EJB3HelloWorldProject
  • Click File –> New –> Other –> EJB –> EJB Project –> Next

2014-12-19_2355

2014-12-19_2356

2014-12-19_2356_001

2014-12-19_2357

  •  Final project structure:

2014-12-22_2056

  • Now create Stateless session bean with its remote interface. Expand project –> expande deployment descriptor –> Right click Session Bean –> New –> Session Bean

2014-12-20_0001

 

  • Enter value as shown below:

2014-12-20_0003

 

2014-12-20_0004

  • In newly created created stateless session bean and remote interface please add below method:

  • Now create HelloWorldClient in same package and paste below code:

  •  We are all done with EJB 3 classes. Before run this project you will have to configure JBoss server to eclipse and if are not sure how to do it please use this tutorial. Now to run project on JBoss server –> Right click Project –> Run As –> Run on Server
  • Once server is started please verify below if EJB3HelloWorldProject successfully deployed or not using below reference:

EJB 3 Hello World JBoss

  • Now run the HelloWorldClient –> Right click –> Run As –> Java Client you will below output:

EJB 3 Hello World JBoss

  • That’s it for more information on EJB 3 please use this link

download Download Project: EJB3HelloWorldProject

Leave a Reply

Your email address will not be published. Required fields are marked *