EJB CICS sample application task guide: Deployment

sgd040


The EJB CICS sample application task guide

Install Web Components on WebSphere Application Server for OS/390

This section describes how to deploy the Web Components of the EJB CICS Sample application onto WebSphere Application Server for OS/390 Version 3.5.

We assume that you have:

Define web application to WebSphere Application Server

    Set directives for WAS Web Server
    The web server directives tell the WAS Web Server how to respond to incoming URLs.

  1. Add the following Web Server directives to the httpd.conf configuration file of your Web server.

    The default applicationserver_root is /usr/lpp/WebSphere. Assuming this was used during installation of WAS, the directives for the CICS Sample application are: ServerInit /usr/lpp/WebSphere/AppServer/bin/was350plugin.so:init_exit/usr/lpp/WebSphere,/demos/was.conf Service /cicssample/* /usr/lpp/WebSphere/AppServer/bin/was350plugin.so: service_exit
    ServerTerm /usr/lpp/WebSphere/AppServer/bin/was350plugin.so: term_exit

    Set Environment variables for Web Server
    Specify the location of the JVM classes that will be used to run the servlet component of the CICS EJB Sample Application.
  2. Ensure that the environment variables in httpd.envars point to the directories in which the code for IBM Developer Kit for z/OS, Java 2 Technology Edition is installed on your system. In the sample http.envars shown, the defaults described in Set up HFS directories for Java Virtual Machine files are assumed and the relevant locations are highlighted in bold.

    PATH=/bin:.:/usr/sbin:/usr/lpp/internet/bin:/usr/lpp/internet/sbin:/usr/lpp/ldap bin:/usr/lpp/java130s/IBM/J1.3/bin: /usr/lpp/ctg/bin:/usr/lpp/ffsserver/ bin: /usr/lpp/ffsserver/bin:/usr/lpp/db2/db2610/bin

    SHELL=/bin/sh

    TZ=EST5EDT

    LANG=C

    LC_ALL=en_US.IBM-1047

    NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lpp/internet/%L/%N:/usr/lpp/ldap/lib/nls/msg /%L/%N

    LIBPATH=/usr/lpp/internet/bin:/usr/lpp/internet/sbin:/usr/lpp/ldap/lib:
    /usr/lpp/java130s/IBM/J1.3/lib/mvs/native_threads:/usr/lpp/ffsserver/lib:
    /usr/lpp/java130/usr/lpp/java130s/IBM/J1.3/lib:/usr/ lib:/usr/lpp/ctg/bin:/usr/lpp/db2/db2610/lib JAVA_HOME=/usr/lpp/java130s/IBM/J1.3

    CLASSPATH=.:/usr/lpp/internet/server_root/CAServlet:/usr/lpp/java130s/IBM/J1.3/lib /classes.zip

    DFHJVSYSTEM_00="CICSC021-C021CICS TS 2.1 region"

    LD_LIBRARY_PATH=/usr/lpp/db2/db2610/lib DB2SQLJPROPERTIES=/usr/lpp/db2/db2610/classes/db2sqljjdbc.properties

    FFSPATH=/usr/lpp/ffsserver/bin

    Note: In this example, the PATH, LIBPATH, NLSPATH and CLASSPATH statements are split for printing purposes. In the actual httpd.conf file each statement is on a single line.
    Define web application to WebSphere Application Server
    The web components of the CICS EJB Sample Application are defined to WebSphere Application Server as properties in the was.conf file for the server. Each property in was.conf file is specified on a single line to define details such as the classpath and document root.

  3. Ensure the was.conf for the Application Server is specified as a fully qualified name in the Web Server configuration file as the second positional parameter on the ServerInit directive (see example above).
  4. Copy j2ee.jar from the IBM Developer Kit for Windows, Java 2 Technology Edition, Version 1.3, supplied on the CICS Tools for EJB Technology CD, to, for example: /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets/
  5. Add this location to the appserver.classpath statement in was.conf, for example:
    appserver.classpath=/usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets/j2ee.jar

    Note: You may already have a number of jar files specified on your appserver classpath in which case you just need to add the j2ee.jar entry to it.

    Define web application components to WebSphere Application Server
    The web application components are defined to WAS as the following statements its was.conf file:

    deployedwebapp.cicssample.host=default_host
    deployedwebapp.cicssample.rooturi=/cicssample
    deployedwebapp.cicssample.documentroot=/usr/lpp/WebSphere/AppServer/hosts /default_host/cicssample/web
    deployedwebapp.cicssample.classpath=
    /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets:
    /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets/SampleCLI.jar:
    /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets/cics/sample /SampleServlet.class
    webapp.cicssample.jspmapping=*.jsp
    webapp.cicssample.jsplevel=1.0
    webapp.cicssample.filemapping=*.html
    webapp.cicssample.filemapping=*.gif
    webapp.cicssample.filemapping=*.jpg
    webapp.cicssample.servlet.SampleServlet.autostart=true
    webapp.cicssample.servlet.SampleServlet.servletmapping=/SampleServlet
    webapp.cicssample.servlet.SampleServlet.code=cics.sample.SampleServlet

    Note: In this example, the documentroot and classpath statements are split for printing purposes. In the actual was.conf file each statement is on a single line.

    deployedwebapp.cicssample.host specifies the administrative name of the virtual host in which a Web application is deployed.

    deployedwebapp.cicssample.rooturi provides the pattern by which a Web application is known within its virtual host. The CICSSample Web application in this case would then be the target for resources with the following URL: your_MVS_host:port_num/cicssample/index.html.

    deployedwebapp.cicssample.documentroot specifies the fully qualified name of the directory root in the file system that contains the files associated with the Web application, such as JSPs, HTML and static files that are to be served by the Web application. The Application Server uses the directory specified on this property to locate a Web component of the specified type. Because the Application Server attempts to access JSPs, HTML and static files using the identity of the hosting Web server's process, your web server requires permission for read access to any information on how Web component requests are resolved to a physical resource.

    deployedwebapp.cicssample.classpath specifies the classpath that the application level class loader searches for a servlet when the system class loader cannot find it. When the Application Server needs to load a servlet, it first attempts to load using a system class loader, which is configured to search the classpath defined in the appserver.classpath property.

    webapp.cicssample.jspmapping specifies a URI pattern that, within the web application, resolves to a file that contains a jsp.

    webapp.cicssample.jsplevel specifies the level of JSP processor to be configured for this application. The JSPs supplied with the EJB CICS Sample application, require the JSP processor to be at level 1.0.

    webapp.cicssample.filemapping specifies a URI-patttern that maps to static content such as html, gifs and jpegs that are to be served within this web application.

    webapp.cicssample.servlet.SampleServlet.autostart indicates whether the servlet should be loaded and its init method driven, whenever the Application Ser ver starts.

    webapp.cicssample.servlet.SampleServlet.servletmapping specifies the path of the servlet, relative to the root URI. The servlet name, in this case SampleServlet is the servlet being invoked. After setting up the servletmapping, you can connect to the servlet by entering the URI-pattern /SampleServlet following the web applications root URI which is /cicssample.

    webapp.cicssample.servlet.SampleServlet.code specifies the unique name of the servlet. This is essentially the package name of the servlet code.

Install the Web Application files

  1. Start a TSO session on the z/OS system where this web application is to run. Use a userid with the permissions required to create directories in /usr/
  2. Start the OMVS shell from your TSO session
  3. Use MKDIR to create the following directory structures:

    /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/web /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets/cics/sample

  4. Copy class files:
    CustomerData.class
    ErrorData.class
    SampleServlet.class
    From: C:\cicsejb\
    To: /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets/cics/sample

  5. Copy the servlet files:
    SampleCLI.jar
    SampleServlet.servlet
    From: C:\cicsejb\
    To: /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/servlets

    <?xml version="1.0"?>
    <servlet>
        <page-list>
          <default-page>
            <uri>/cicssample/SampleResults.jsp</uri>
          </default-page>
          <error-page>
            <uri>/cicssample/SampleError.jsp</uri>
          </error-page>
        </page-list>
        <code>cics.sample.SampleServlet</code>
    </servlet>
    

  6. Copy index.html into the directory:
    /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/web

    <!
     * index.html    CICS EJB Sample HTML page
     *
     * DATE:         2000/08/18
     * VERSION:      1.0
     *
     * This HTML form is the user front end for the CICS EJB sample. It takes a customer number and 
     * Naming Service parameters and passes them to the SampleServlet.
     *
     * On installation of the sample, the nameService, providerURL and jndiName values should be
     * changed to match your JNDI Name Server setup.
    
    <HTML>
    <TITLE>CICS EJB Sample</TITLE>
    <BODY background="BankOfEcommerce.gif">
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center">CICS EJB Sample</H1>
    <FORM METHOD="post" ACTION="/cicssample/sample">
      <P align="center">Enter a customer number between 1 and 5, edit the JNDI Name 
        Server details as required, then click on Submit.</P>
      <div align="center">
        <TABLE border="0">
          <TR> 
            <TD>Customer Number</TD>
            <TD> 
              <INPUT TYPE="text" NAME="customerNumber" ID="customerNumber" value="1" SIZE="20" MAXLENGTH="20" >
            </TD>
          </TR>
          <TR> 
            <TD>Name Service:</TD>
            <TD> 
              <INPUT TYPE="text" NAME="nameService" ID="nameService" value="com.ibm.ejs.ns.jndi.CNInitialContextFactory" SIZE="50">
            </TD>
          </TR>
          <TR> 
            <TD>Provider URL:</TD>
            <TD> 
              <INPUT TYPE="text" NAME="providerURL" ID="providerURL" value="iiop://adsjndi.hursley.ibm.com:900" SIZE="50">
            </TD>
          </TR>
          <TR>
            <TD>JNDI Name:</TD>
            <TD>
              <input type="text" name="jndiName" id="jndiName" value="ASG/CICSSample" size="20">
            </TD>
          </TR>
          <TR> 
            <TD>  </TD>
            <TD> 
              <p> </p>
              <p>
                <input type="submit" name="Submit" id="Submit" value="Submit">
                <input type="reset" name="Reset" id="Reset" value="Reset">
              </p>
            </TD>
          </TR>
        </TABLE>
      </div>
      <P align="center">     </P>
      </FORM>
    </BODY>
    </HTML>
    

  7. Copy SampleError.jsp
    To: /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/web

    <HTML>
    <HEAD><TITLE>CICS EJB Sample Error</TITLE></HEAD>
    <BODY background="BankOfEcommerce.gif">
    <jsp:useBean id="ed" scope="request" class="cics.sample.ErrorData" />
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center">CICS EJB Sample Error</H1>
    <div align="center">
      <TABLE border="1">
       <TR> 
        <TD>Error data:</TD>
        <TD><%=ed.getMessage() %></TD>
       </TR>
      </TABLE>
    </div>
    </BODY>
    </HTML>
    

  8. Copy SampleResults.jsp
    To: /usr/lpp/WebSphere/AppServer/hosts/default_host/cicssample/web

    <HTML>
    <HEAD><TITLE>CICS EJB Sample Results</TITLE></HEAD>
    <BODY background="BankOfEcommerce.gif">
    <jsp:useBean id="theCustomer" scope="request" class="cics.sample.CustomerData" /> 
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center"> </H1>
    <H1 align="center">Sample Account Query Result</H1>
    <div align="center">
      <TABLE border="1">
        <TR> 
          <TD>Customer Number:</TD>
          <TD><% out.print(new Integer(theCustomer.getCustNo()).toString()); %></TD>
        </TR>
        <TR> 
          <TD>First Name:</TD>
          <TD><%=theCustomer.getFirstName() %></TD>
        </TR>
        <TR> 
          <TD>Last Name:</TD>
          <TD><%=theCustomer.getLastName() %></TD>
        </TR>
        <TR> 
          <TD>Address:</TD>
          <TD><%=theCustomer.getAddress() %></TD>
        </TR>
        <TR> 
          <TD>City:</TD>
          <TD><%=theCustomer.getCity() %></TD>
        </TR>
        <TR> 
          <TD>State:</TD>
          <TD><%=theCustomer.getState() %></TD>
        </TR>
        <TR> 
          <TD>Country:</TD>
          <TD><%=theCustomer.getCountry() %></TD>
        </TR>
        <TR> 
          <TD>Account Number:</TD>
          <TD><% out.print(new Integer(theCustomer.getAcctNo()).toString()); %></TD>
        </TR>
        <TR> 
          <TD>Balance:</TD>
          <TD><% out.print(new Double(theCustomer.getBalance()).toString()); %></TD>
        </TR>
      </TABLE>
    </div>
    </BODY>
    </HTML>
    

    Note: You can choose to use a directory structure more suitable for your OS/390 HFS environment as long as you ensure this is reflected in the Web application definition within your was.conf file.

Confirm that WAS initialisation is correct

  1. Re-start your Web Server
  2. Ensure that the WebSphere Application Server plugin initialisation is successful by checking for the following message in the SYSOUT log of your Web Server.
    IBM WebSphere Application Server native plugin initialization went OK :-)
  3. Confirm that web application initialisation is correct

    You should also browse the WebSphere logs directory to ensure that the cicssample web application initialisation was completed successfully. The location of the WebSphere Application Server logs directory is specified using the property appserver.logdirectory in your was.conf file.

    Invoke the EJB CICS Sample servlet
    To invoke the Web application you have just configured, use the URL of the following format from your browser:

    Http://host:portnum/cicssample/index.html

    Where,
    host is the IP address or DNS name of your OS/390 system
    portnum is the Port Number your HTTP Server is configured to listen on.