Previous Topic: RMI Server ExecutionNext Topic: Other Transaction Steps


Enterprise JavaBean Execution

The Enterprise JavaBean Execution step lets you acquire a reference to and make calls on an Enterprise JavaBean (EJB) running in a J2EE application server.

Testing an EJB is similar to testing a Java object. DevTest dynamically connects to the EJB using the Home EJB interface, and then from it creates an instance of an EJB object. This process is a little different for EJBs, as they do not require a home interface. The EJB under test is loaded into the Complex Object Editor, where it can be manipulated without having to write any Java code.

Prerequisites: Knowledge of the Complex Object Editor is assumed. The application client JAR and client EJB JAR must be in the DevTest classpath. Both of these JAR files are copied into the hotDeploy directory. The hotDeploy directory contains the jboss-all-client.jar file for the JBoss application server and the examples JAR file so you can run the EJB examples immediately.

Parameter Requirements:

The EJB deployer should provide this information.

Connecting to WebSphere with DevTest Solutions using SIBC

IBM has an EJB and JMS client that you can download and use with the Sun JVM. The client is available here.

Follow these steps:

  1. Download this file; then run their installer.
  2. Issue the following command:
    java -jar sibc_install-o0902.06.jar jms_jndi_sun <output_directory> 
    
  3. Get the following files from your <output_directory>:
  4. To reference the previous three JAR files, Create a LISA_PRE_CLASSPATH environment variable.

    For example: LISA_PRE_CLASSPATH=C:\sibc.jms.jar;C:\sibc.jndi.jar;C:\sibc.orb.jar;

  5. Edit local.properties and add the following line:
    com.ibm.CORBA.ORBInit=com.ibm.ws.sib.client.ORB 
    
  6. On the JMS step, use the following settings:
Example

This example uses the ITKO example server, a JBoss server. To use your local demo server, use localhost as the host name.

  1. Enter the following parameters:
    Choose App Server

    Select your application server from the list. If your application server is not on the list, select the Other/You Specify option.

    The lower section of the editor changes, depending on your selection. The previous graphic shows the configuration panel for JBoss.

  2. For the JBoss panel, enter the following parameters:
    Host Name or IP Address

    Enter the hostname or IP address of your application server.

    Port Number

    Enter the port number.

    User

    Enter if a user ID is required for the application server.

    Password

    Enter if a password is required for the application server.

  3. Click Next.

 

For the Other/You Specify Window

  1. Enter the following parameters:
    JNDI Factory

    Enter or select the fully qualified JNDI factory class name for your application server.

    JNDI Server URL

    Enter or select the JNDI server name.

    User

    Enter if a user ID is required for the application server.

    Password

    Enter if a password is required for the application server.

  2. Click Next.

    The New EJB Setup window opens and lists all the JNDI names that are registered with the application server.

    Enterprise JavaBean Execution step New EJB Setup window

  3. Select the name of the appropriate EJB home interface.

    In this example, the JNDI name is com.itko.examples.ejb.UserControlBean. The EJB3 specification enables stateful and stateless beans to bind to the JNDI tree directly and not require a home interface. If so, the bean can be selected directly and DevTest does not need to create an instance.

  4. Click Next.

    The object is constructed and loaded into the Complex Object Editor.

    Enterprise JavaBean Execution step in COE

    In the Execution Info area, the current EJB information is displayed. If you plan to reuse this EJB, you can keep the references to the EJB object and the EJB Home by selecting the following check boxes:

    If the bean is an EJB 3 bean without a home interface, the Keep EJB Home Reference check box is disabled. Set the If Exception to the step to redirect to if an exception occurs.

    The EJB step has a default name using this convention: EJB javaMethod dynamic java execution. Before the step is saved, is entered, as shown previously, the default step name is EJB. If another step also uses the default step name, a number is appended to it. You can change step names at any time.

  5. You can now manipulate the object, and execute methods, using the Complex Object Editor.

    The usage is the same as in the RMI Server Execution step.