EJB 2 Hello World JBoss

EJB 2 Hello World JBoss

In this demo you will see how to create EJB 2 Hello World using JBoss application server. Please follow below steps:

Below are needed:

  • JBoss Application Sever 5.1 community version
  • Eclipse 3.2 or above (In this Kepler has been used)

Steps:

  • Create EJB project name: EJB2HelloWorld in eclise. To create project click File –> New –> Other –> EJB –> EJBProject (Please note: when you are creating project you will have to choose Target run time: JBoss 5.1 and EJB module version 2.0)
  • Final project structure

EJB 2 Hello World JBoss

  • ejb-jar.xml:

  • jboss.xml:

  • Hello.java:

  • HelloBean.java

  • HelloHome.java

  • HelloWorldClient.java

  • Now to run this application you will have to configure JBoss in eclipse and if you are not sure how to do it please use this tutorial. Once you are done with configure with JBoss double click to open it sever configuration and choose use the JBoss deploy foder as below:

EJB 2 Hello World JBoss

  • We have done this to validate if EJB2HelloWorld deploy on deploy folder or not. Now right click JBoss server –> Add and Remove –> Add EJBW2HelloWorld project then click OK
  • Now right click –> Start to start the JBoss server. Once server is started please search below on console:

EJB 2 Hello World JBoss

  • Now validate if jar file is deployed or not as below:

EJB 2 Hello World JBoss

  •  Everything seems good. Now let’s run the client. Right click HelloWorldClient.java –> Run As –> Java Application you will below on console:

EJB 2 Hello World JBoss

  • That’s it for more information on EJB 2 please visit this link

download Download Project: EJB2HelloWorld

Leave a Reply

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