Testing the EJB Bank Account sample

To test the application:
  1. Ensure that all the following are running:
    • The Web server
    • The Web application server and the sample application
    • The name server
    • The CICS region
    • The DB2 subsystem
  2. Start a Web browser and point it at the URL of your Web server, followed by “cicssample”. For example:
    http://myServer.ibm.com/cicssample
    The opening screen shown in Figure 1 appears.
    Figure 1. Opening screen of the EJB Bank Account sample application
    The picture shows the opening screen of the “EJB Bank Account” sample application. The title, in a large font, is “CICS Bank Account EJB Sample”. The next line says “Choose a customer number to query. Valid account numbers range between 1 and 5.”. Underneath this are seven text input fields.The first text input field is labeled “Customer Number:”. The default value is 1.The second text input field is labeled “Provider URL:”. Its default value is “iiop://nameserver.location.company.com:900”. The third text input field is labeled “CORBASERVER JNDI prefix:”. Its default value is “samples”. The fourth text input field is labeled “Bean Name:”. Its default value is “CICSSample”. The fifth text input field is labeled “Container Distinguished Name:”. Its default value is “ibm-wsnTree=cicsejbs,c=uk”. The sixth text input field is labeled “Node Root Relative Distinguished Name:”. Its default value is “ibm-wsnName=cicshostname,ibm-wsnName=NodeRoots”. The seventh text input field is labeled “JNDI Initial Context Factory:”. Its default value is “default”. At the bottom of the form are two buttons—“Submit” and “Reset”.
  3. Enter a customer number. (Using the supplied DB2 data, valid customer numbers are 1 through 5).
  4. Check that the Provider URL:, CORBASERVER JNDI prefix:, Bean Name:, Container Distinguished Name:, Node Root Relative Distinguished Name:, and JNDI Initial Context Factoryfields contain values that are valid for your installation. If they do not, overtype them as follows:
    Provider URL:
    Enter the URL and port number of the name server where the enterprise bean is published. (These are specified by the com.ibm.cics.ejs.nameserver property in your JVM properties file.) For example:
    • If you are using a COS Naming Server with a URL of mycosns.ibm.com and a port number of 900, specify “iiop://mycosns.ibm.com:900”.
    • If you are using an LDAP name server with a URL of myldapns.ibm.com and a port number of 389, specify “ldap://myldapns.ibm.com:389”.
    • If you are using the COS Naming Directory Server supplied with WebSphere® Application Server Version 5 or later, with a URL of mycosns.ibm.com and a port number of 2809, specify:
      com.ibm.cics.ejs.nameserver=iiop://mycosns.ibm.com:2809/domain/legacyRoot
    For detailed information about how to specify the location of the name server, see the description of the com.ibm.cics.ejs.nameserver property in the CICS® System Definition Guide.
    CORBASERVER JNDI prefix:
    Enter the JNDI prefix of your CorbaServer. If you are using the CORBASERVER definition supplied in DFH$EJB, you do not need to change the default value of “samples”.
    Bean name:
    Enter the name of the enterprise bean used by the sample, as defined in the deployment descriptor in the supplied SampleEJB.jar file. Unless you have renamed the bean, you do not need to change the default value of “CICSSample”.
    Container Distinguished Name:
    If you are using an LDAP name server, enter the distinguished name of the LDAP system namespace root, as supplied by your LDAP administrator. (The distinguished name of the LDAP system namespace root is specified by the com.ibm.ws.naming.ldap.containerdn property in your JVM properties file.) If you are using a COS Naming Server, the value of this field is ignored.
    Node Root Relative Distinguished Name:
    If you are using an LDAP name server, enter the distinguished name of the LDAP node root, as supplied by your LDAP administrator. (The distinguished name of the LDAP node root is specified by the com.ibm.ws.naming.ldap.noderootrdn property in your JVM properties file.) If you are using a COS Naming Server, the value of this field is ignored.
    JNDI Initial Context Factory:
    Select the appropriate JNDI initial context factory from the drop-down list. If your Web application server is WebSphere, the factory to use depends on:
    • The version of WebSphere you're using
    • The location of WebSphere—that is, whether it's on a distributed platform such as Windows NT or a host platform such as z/OS or OS/390®
    • The type of name server you're using—COS naming or LDAP
    Table 1 shows the correct initial context factory to specify, if your Web application server is WebSphere.
    Table 1. Setting the initial context factory, according to the version and location of WebSphere and the type of name server
    WebSphere Version Location of Web application server Name server type Initial context factory to use
    3.5 Distributed COS com.ibm.ejs.ns.jndi.CNInitialContextFactory
    3.5 Distributed LDAP com.ibm.jndi.LDAPCtxFactory
    3.5 z/OS or OS/390 COS com.sun.jndi.cosnaming.CNCtxFactory
    3.5 z/OS or OS/390 LDAP com.sun.jndi.ldap.LdapCtxFactory
    4 or later Distributed COS or LDAP com.ibm.websphere.naming.WsnInitialContextFactory
    4 or later z/OS or OS/390 COS com.sun.jndi.cosnaming.CNCtxFactory
    4 or later z/OS or OS/390 LDAP com.sun.jndi.ldap.LdapCtxFactory
    If your Web application server is not WebSphere, choose the appropriate value from the drop-down list.
    Note: The drop-down list contains several initial context factory classes, plus a “default” list item. The sample application assigns the value of the default list item as follows:
    1. If the com.ibm.websphere.naming.WsnInitialContextFactory class is found in the Java classpath, the sample makes it the default item. This class is a “wrapper” class that wraps both com.ibm.ejs.ns.jndi.CNInitialContextFactory and com.ibm.jndi.LDAPCtxFactory. The sample determines the correct base class to use by examining the type of name server that you've specified in the Provider URL field: if the specified protocol is “iiop”, the sample uses com.ibm.ejs.ns.jndi.CNInitialContextFactory; if it's “ldap”, the sample uses com.ibm.jndi.LDAPCtxFactory.
    2. If the com.ibm.websphere.naming.WsnInitialContextFactory class is not found in the Java classpath, the sample determines the correct class to use by examining the type of name server that you've specified in the Provider URL field: if the specified protocol is “iiop”, the sample uses com.ibm.ejs.ns.jndi.CNInitialContextFactory; if it's “ldap”, the sample uses com.ibm.jndi.LDAPCtxFactory.

    If none of the values in the drop-down list are valid for your installation, select the Other radio button and enter the correct value in the lower text field.

  5. Press the SUBMIT button. This invokes the servlet and runs the application.

    If the application is configured correctly and the input values are valid, the SampleResults JSP displays the customer's details in the browser. Figure 2 shows the result of a successful enquiry.

    Figure 2. Results screen of the EJB Bank Account sample application
    The picture shows the results screen of the “EJB Bank Account” sample application. The title, in a large font, is “Sample Account Query Result”. Underneath this are nine output fields.The first output field is labeled “Customer Number:”. Its value is “1”.The second output field is labeled “First Name:”. Its value is “RICK”. The third output field is labeled “Last Name:”. Its value is “WEAVER”. The fourth output field is labeled “Address:”. Its value is “5 WEST KIRKWOOD”. The fifth output field is labeled “City:”. Its value is “ROANOKE”. The sixth output field is labeled “State:”. Its value is “TX”. The seventh output field is labeled “Country:”. Its value is “US”. The eighth output field is labeled “Account Number:”. Its value is “2”. The ninth output field is labeled “Balance:”. Its value is “9000.53”.

    If the application is not configured correctly, or one or more of the input values is invalid, the SampleError JSP displays an error message in the browser. The readme.txt file contains hints and tips that may help you debug a failed application.