Using the Postingv2Sample sample

You can install, run, and monitor an application that mimics account transaction processing using the Postingv2Sample sample. The sample is built using the simple Plain Old Java Object (POJO) model and packaged using the batch packager, WSBatchPackager.

Before you begin

  1. Augment existing WebSphere® Application Server profiles to support the Compute Grid applications or create profiles that include support for the Compute Grid applications.
  2. Start the appropriate application servers and any supporting management processes.
  3. Configure the location of the job scheduler.

    The following steps assume that you are setting up a stand-alone application server test environment to explore the capabilities of the Compute Grid applications.

    If you are setting up a clustered environment, you must perform additional steps. You must create a network database to support the job scheduler. You must configure related job scheduler database connectivity settings. Read the topic about configuring the job scheduler.

    1. On the administrative console, click System administration > Job scheduler.
    2. Set Scheduler hosted by to the identity of the appropriate application server.

      WebSphere:cell=ndcell,node=node1,server=server1

    3. Save the changes.

About this task

Use the following general procedure to set up a database for the Postingv2Sample sample, and install and run the sample. Read the topics about the job scheduler, the job management console, and developing applications for detailed information.
Note: You must have a compatible network database such as DB2® or Oracle. This sample does not work with Apache Derby because multiple simultaneous connections are created during a step.

Procedure

  1. Set up the DB2 or Oracle network database for the Postingv2Sample sample.

    The database is for the sample itself. The job scheduler has its own database.

    1. Run the java –version command.

      By running the command, you can verify that Java Version 1.6 or later is installed and included in the PATH variable of your operating system.

    2. Create the database.

      Use the appropriate DDL file that is located in the following directory. Examples of DDL files are createPostingsV2TableDB2.ddl and CreatePostingsV2TablesOracle.ddl.

      [For Linux operating system][For HP-UX operating system][For Solaris operating system][For AIX operating system][For z/OS operating system] <app_server_root>/longRunning

      [For Windows operating system] <app_server_root>\longRunning

      For example, for DB2, create the ACTDB database, then open the DB2 command prompt and run db2 -tf <path to the ddl file>.

    3. Create the Java Database Connectivity (JDBC) resources.
      1. On the administrative console, click Resources > JDBC > JDBC providers.
      2. Create a JDBC XA provider at the server scope with the following properties:
        Database type
        DB2.
        Provider type
        DB2 Universal JDBC Driver Provider.
        Implementation type
        XA data source.
        Name
        DB2 Universal JDBC Driver Provider (XA).
        Description
        Accept the default value.
      3. On the administrative console, click Resources > Data Sources > Default Datasource.
      4. Create a component-managed authentication alias for user name and password access to the DB2 database:
        In the Related Items column, click JAAS - J2C authentication data and complete the following properties:
        Alias
        Enter a Component-managed authentication alias value.
        Username
        Enter the user name with which to access DB2.
        Password
        Enter the password for the user name.
      5. Click OK.
      6. On the administrative console, click Resources > JDBC > Data source.
      7. Create a data source.
        Data source name
        Enter the following information: Postings data source (XA).
        Java Naming and Directory Interface (JNDI) name
        Enter the following information: jdbc/postingsv2.

        Click Next.

        JDBC provider
        Select the existing JDBC provider DB2 Universal JDBC Driver Provider.

        Click Next.

        Database name
        Enter ACTDB, which is the name of the DB2 database for this example.
        Server Name
        Enter the IP address of the DB2 instance.
        Port Number
        Enter the port number of the DB2 instance.

        Click Next.

        Container-managed authentication alias
        Select the Component-managed authentication alias that you created in a previous step.

        Click Next, then Finish.

      8. Select the new data source and click Test Connection to test the connection to the database.
  2. Install the Postingv2Sample sample.
    1. In the administrative console, click Applications > New application > New Enterprise Application.
    2. Specify the full path of the sample; for example:

      [For Linux operating system][For HP-UX operating system][For Solaris operating system][For AIX operating system][For z/OS operating system] <app_server_root>/installableApps/Postingv2Sample.ear

      [For Windows operating system] <app_server_root>\installableApps\Postingv2Sample.ear

    3. Complete the steps using the wizard.
      1. Select Detailed - Show all installation options and parameters.
      2. Expand the list for Choose to generate default bindings and mappings; Select Generate Default Bindings; click Next.
      3. In Step 2, select the endpoint server or cluster.
      4. Accept the defaults for the rest of the values.
      5. Click Finish.
    4. If you plan to install additional sample applications, do so now.
    5. Restart the application server or start the application.

      If this time is the first time that you are installing an application, restart the server. Otherwise, you can start the application under the Applications > Application Types > WebSphere enterprise applications panel.

  3. Run the Postingv2Sample sample.
    1. Edit the postingsv2samplexJCL.xml xJCL file.

      You use the xJCL file to submit a job to the Postingv2Sample sample.

      The file is located in the following directory:

      [For Linux operating system][For HP-UX operating system][For Solaris operating system][For AIX operating system][For z/OS operating system] <app_server_root>/longRunning/postingsv2samplexJCL.xml
      • Modify the postingsDataStream property in the substitution-props section to include a valid directory.

        <prop name="postingsDataStream" value="/tmp/post-input.txt" />

      [For Windows operating system] <app_server_root>\longRunning\postingsv2samplexJCL.xml
        • Modify the postingsDataStream property in the substitution-props section to include a valid directory.

          <prop name="postingsDataStream" value="C:\\temp\\post-input.txt" />

    2. Start the job management console.

      In a web browser, type the following web address:

      http://<job scheduler server host>:<port>/jmc

      <job scheduler server host> is the host address and <port> is the WC_defaulthost port of the application server on which the running job scheduler is installed.

      To view on the administrative console the port numbers assigned to a given application server, click Servers > Server Types > WebSphere application servers > server_name > Communications > Ports.

    3. Submit the postingsv2samplexJCL.xml xJCL file.

      On the job management console, click Job Management > Submit a job, and specify the path to the xJCL file.

  4. Monitor the submitted job.

    On the job management console, click Job Management > View jobs and view jobs based on characteristics such as the job ID and the job submitter.

    You can determine whether the job completed successfully by going to the second page of the job viewer and scrolling to the bottom. If the job did complete successfully, you see a Job completed successfully message.