Packaging and Deploying A Stateful EJB

  1. The EJB project needs to be packaged in a JAR file. We will be re-using the packaging configuration which was created in Part 1: Packaging A Stateless EJB.

  2. Right-click on the Calculator project and select Run Packaging. The packaging will display its output in the console. The output should look like this:

    Buildfile: C:\ejb3workspace\Calculator\packaging-build.xml
    N65540:
    _packaging_generation_:
    BUILD SUCCESSFUL
    Total time: 906 milliseconds
    								

  3. After the execution, you should have a project that looks like this:

    Project with packaged Session EJBs

  4. OPTIONALLY: Undeploy the previous calculator.jar EJB module as described here: Undeploying An EJB JAR file.

  5. In the Project Explorer View right click the calculator.jar file and select Run As > Run on Server context menu.

  6. In the Console View, you should see some deployment activity. The Session EJBs are now deployed:

    								
    16:00:32,527 INFO  [Ejb3Deployment] EJB3 deployment time took: 47
    16:00:32,558 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=calculator.jar,name=StatefulCalculatorBean,service=EJB3 with dependencies:
    16:00:32,558 INFO  [JmxKernelAbstraction] 	jboss.j2ee:jar=calculator.jar,name=StatelessCalculatorBean,service=EJB3
    16:00:32,558 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=calculator.jar,name=StatelessCalculatorBean,service=EJB3 with dependencies:
    16:00:32,574 INFO  [EJBContainer] STARTED EJB: by.iba.ejb.StatelessCalculatorBean ejbName: StatelessCalculatorBean
    16:00:32,652 INFO  [EJBContainer] STARTED EJB: by.iba.ejb.StatefulCalculatorBean ejbName: StatefulCalculatorBean
    16:00:32,699 INFO  [SimpleStatefulCache] Initializing SimpleStatefulCache with maxSize: 100000 timeout: 300 for jboss.j2ee:jar=calculator.jar,name=StatefulCalculatorBean,service=EJB3
    16:00:32,699 INFO  [EJB3Deployer] Deployed: file:/C:/jboss4/server/default/deploy/calculator.jar
    								

  7. OPTIONALLY: Verify the Stateful Bean Remote [Business] Interface is available now via JNDI.

    Open JMX Console in your browser and select the service=JNDIView link.

    Invoke the java.lang.String list() method to output JNDI info as text.

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine