Running Service Sample Application on RAD

The service sample is a Websphere 6 application for user's reference purpose. It will be only available within Rational® Application Developer.

The procedures in this topic describe how to install the Service Sample Application on WebSphere® Application Server and run the sample in one of the Test Environment configurations. The procedures apply if your WebSphere Application Server is running on Windows®, Linux® and Unix platform.

To set up the application on WebSphere Application Server, follow these steps:

  1. Copy external files:
    1. Extract the BTTSampleServiceWeb.war file from BTTSampleService.ear, then extract the \dse directory from the BTTSampleServiceWeb.war.
    2. If your operating system is Windows, create a directory c:\dse. If your operating system is Unix or Linux, create a directory /dse.
    3. Copy all the files in the \dse directory you extracted from BTTSampleServiceWeb.war to the c:\dse directory or the /dse directory that you created in 1.b.
  2. Create database and tables:
    1. Run DB2® CREATE DATABASE SAMPLE in DB2 command window to create a database named "sample". You can set user and password for database SAMPLE. For example, set both user and password as db2inst1.
    2. Create three tables:
      1. Create a directory called c:\ temp if you are using Windows, or /temp if you are using Unix or Linux.
      2. If your operating system is Windows, copy <intall root>/dbtools/Windows/DB2/tableDefinition/cha/createCHATables.ddl to the c:\temp directory. If your operations system is Unix or Linux, copy <intall root>/dbtools/Unix/DB2/tableDefinition/cha/createCHATables.ddl to the /temp directory.

        Note that <install root> refers to the root directory where you have the toolkit installed.

      3. Change your current directory to /temp, and open a DB2 Command Window.
      4. In the DB2 Command Window, run DB2 CONNECT TO SAMPLE USER db2inst1 USING db2inst1.
      5. In the DB2 Command Window, run db2 -tvf createCHATables.ddl.

        You will see messages indicating that CHAChildren, CHAInstance and CHAControl tables have been created successfully.

  3. Optional: If your operating system is Unix or Linux, set the dse path value of web.xml for BTTSampleServiceWeb project:
    1. Open the J2EE Perspective. Select BTTSampleServiceWeb and double-click Web Deployment Descriptor.
    2. Set dseIniPath value as /dse/dse.ini.
      <env-entry>
       	<env-entry-name>dseIniPath</env-entry-name>
       	<env-entry-value>/dse/dse.ini</env-entry-value>
       	<env-entry-type>java.lang.String</env-entry-type>
      </env-entry>

      Put this file back into BTTSampleServiceWeb.war, then put BTTSampleServiceWeb.war back to BTTSampleService.ear.

  4. Optional: If your operating system is Unix or Linux, set the dse path value of ejb-jar.xml for BTTCHAEJB project.
    1. Open the J2EE Perspective. Select BTTCHAEJB and double-click ejb-jar.xml.
    2. Set dseIniPath value as /dse/dse.ini.
      <env-entry>
       	<description></description>
       	<env-entry-name>dseIniPath</env-entry-name>
       	<env-entry-type>java.lang.String</env-entry-type>
       	<env-entry-value>/dse/dse.ini</env-entry-value>
      </env-entry>

      Put this file back into BTTCHAEJB.jar, and then put BTTCHAEJB.jar back to BTTJavaSample.ear.

  5. Open a Web Browser, input the following URL to open the Administrative Console: http://serverName:9090/admin.
  6. Import BTTSampleService.ear into WebSphere Application Server:
    1. In the navigation bar, select Applications > Install new Application.
    2. In the main frame, click Browse and locate the BTTSampleService.ear file. Click Next.
    3. In Step2 frame, specify the DataBase Type.
    4. In Deploy EJBs Option - Database Type field, use the default value. For DB2, select DB2UDB_V81.
    5. In Step4 frame, type jdbc/CHADataSource for JNDI Name. Use default value for other settings.
    6. In setp10 frame, Click Finish.
    7. Click Save to Master Configuration.
    8. Click Save to finish importing BTTJavaSample.ear.
  7. Set up JDBC Providers:
    1. In the navigation bar, select Resource > JDBC Providers.
    2. In the main frame, click New.
    3. In JDBC Providers field, select the JDBC Provider. It must be the (XA) JDBC Provider. Click OK.
    4. For other settings, use default value, and click OK to return to the JDBC Providers page.
    5. Click the Data Source Name.

      DB2 Universal JDBC Driver XA DataSource

    6. In Additional Properties section, click Data Source.
    7. Click New.
    8. Use jdbc/CHADataSource. Click OK to return to the Data Sources page.
    9. Select the option Use this Data Source in container managed persistence (CMP).
    10. Click the Data Source Name.
    11. In the Related Items section, click J2C Authentication Data Entries.
    12. Click New and make the following settings:
      • Alias: CHA
      • User ID: db2inst1
      • Password: db2inst1
      Click OK to save the value.
    13. In the navigation bar, select Resource > JDBC Providers > JDBC Provider Name > Data Source.
    14. Click Data Source Name.
    15. Select CHA for Component-managed Authentication Alias and Container-managed Authentication Alias fields. Save the configuration.
    16. Click Data Source Name.
    17. In Additional Properties section , click Custom Properties. Set the databaseName and serverName. Use the default value for other settings. Click Save on the top of the page.
    18. In the navigation bar, select Resource > JDBC Providers > JDBC Provider Name > Data Source. Select the Data Source and click Test Connection. You will see some messages indicating that Test Connection was successful.
  8. Set up Object pool managers:
    Object pool managers
    1. In the navigation bar, select Resource > Object pool managers.
    2. In the main frame, click New.
    3. Type BTTPool for name and JNDI name.
    4. Use the default value for other settings. Click OK.
    5. Click Save on the top of the page.
  9. Start the applications:
    1. In the navigation bar, select Applications > Enterprise Applications.
    2. Select BTTSampleService and click Start.
  10. Run the BttSampleServiceClient:

    Client side should add parameters to run for WebSphere, but for Windows limitation, service sample cannot run with enough quantity parameters on Windows command console. So user could execute it on Rational Application Developer IDE.

    Run New_configuration

    1. From the Rational Application Developer menu, right click BttSampleServiceClient, click Run > Run.
    2. Double-click WebSphere v6.0 Application Client in the new window, and select New_Configuration.
    3. Click Run.