Setting up the HTMLSample application in WebSphere Studio Application Developer 5.1.1 running on Linux

The following procedure describes how to install the HTMLSample Application in WebSphere(R) Studio Application Developer 5.1.1 and run the sample in one of the Test Environment configurations.

The following procedure applies if you are running WebSphere Studio Application Developer 5.1.1 on Linux(R).

To set up the application in WebSphere Studio Application Developer 5.1.1:

  1. Copy external files
    1. Extract the BTTHTMLSampleWeb.war file from BTTHTMLSample.ear, then extract the \dse directory from the BTTHTMLSampleWeb.war.
    2. On your OS system, create a directory /dse.
    3. Copy all the files in the \dse directory you extracted from BTTHTMLSampleWeb.war to the \dse directory you created in step 1.a.
  2. Create database and tables.
    1. Run DB2(R) 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 /temps.
      2. Copy createCHATables.ddl to directory /temps.
      3. Shift to /temps directory and open DB2 Command Window.
      4. In DB2 Command Window, run DB2 CONNECT TO SAMPLE USER DB2INST1 USING DB2INST1
      5. In DB2 Command Window, run db2 -tvf createCHATables.ddl

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

  3. Import BTTHTMLSample.ear
    1. Start WebSphere Studio Application Developer 5.1.1. From the menu bar, open J2EE perspective. Select File > Import > EAR file and click Next.
    2. In the Import wizard, set the following parameters:
      • EAR File: <toolkit root>\samples\HtmlSampleApplication\BTTHTMLSample.ear
      • Enterprise Application project name: BTTHTMLSample
    3. Click Finish
  4. Set dse path value of web.xml for BTTHTMLSampleWeb project.
    1. Open J2EE Perspective. Select BTTHTMLSampleWeb 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>
  5. Set dse path value of ejb-jar.xml for BTTCHAEJB project.
    1. Open 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>
  6. Set up server in WebSphere Studio Application Developer 5.1 test environment.
    1. Open Server Perspective.
    2. Click New > Server and Server Configuration and set the following parameters:
      • Server name: HTMLSampleServer
      • Folder: Servers
      • Server Type: WebSphere version 5.1 Test Environment
    3. Click Finish.
    4. Define JAAS Authentication entries in server configuration.
      1. In the Server Configuration panel, double-click the server instance HTMLSampleServer.
      2. Select the Security tab. In the Cell Settings section, click Add button to add a JAAS Authentication Entry and set the following parameters:
        • Alias: CHA
        • User ID: db2inst1
        • Password: db2inst1
        • Description: HTMLSample
    5. Click OK.
    6. Select Data source tab. In the Server Settings section, Click Add button to add an IBM(R) DB2 JDBC Provider (XA) to the JDBC Provider list.
    7. In the window that pops up , select IBM DB2 in the DataBase type section and DB2 JDBC Provider (XA) in the JDBC Provider type section, Click Next.
    8. In the window that pops up, input name DB2 JDBC Provider (XA) and Click Finish.
    9. Also in Data source tab and the Server Settings section , select DB2 JDBC Provider (XA) in JDBC Provider list and then click Add button to create a Data Source. In the window that pops up , select DB2 JDBC Provider (XA) in the type of JDBC Provider section and select Version 5.0 data source in the data source type section . Click Next.
    10. In the pop-up Modify Data Source window, set the following parameters:
      • Name: CHADataSource
      • JNDI name: jdbc/CHADataSource
      • Description: CHA Exercise
      • Statement cache size: 10
      • Data source helper class name: com.ibm.websphere.rsadapter.DB2DataStoreHelper
      • Connection timeout: 1800
      • Maximum connections: 10
      • Minimum connections: 1
      • Reap time: 180
      • Unused timeout: 1800
      • Aged timeout: 0
      • Purge policy: EntirePool
      • Component-managed authentication alias: CHA
      • Container-managed authentication alias: CHA
      • Check the checkbox: use this data source in container managed persistence (CMP)
    11. Click Finish. Save the modification of Server Configuration and close Server Configuration Content Editor.
  7. Do EJB to RDB mapping.
    1. From J2EE perspective, right-click BTTCHAEJB and select Generate > EJB to RDB Mapping .
    2. In the EJB to RDB Mapping window, select Create a new backend folder option, click Next.
    3. Select Top Down option and click Next.
    4. Do the following settings:
      • In Target Database section, select DB2 Universal Database(TM) V8.1
      • In Database name section, type SAMPLE.
      • In Schema name section, type db2inst1.
      • Uncheck the two checkbox Generate DDL and WebSphere 3.x Compatible.
    5. Click Finish.
  8. Deploy BTTCHAEJB and BTTHTMLSampleEJB.
    1. From J2EE perspective, right-click BTTCHAEJB. Select Generate > Deploy and RMIC Code.
    2. In the window that pops up, check all check-boxes and Click Finish.
    3. From J2EE perspective, right-click BTTHTMLSampleEJB, select Generate > Deploy and RMIC Code.
    4. In the window that pops up, check all check-boxes and Click Finish.
  9. Associate the BTTHTMLSample project with the server configuration. In the Servers view, right-click and select Add and Remove Projects. Add BTTHTMLSample ,Click Finish.
  10. Start HTMLSampleServer. In the HTMLSampleServer view, right-click and select Start.
  11. Run HTMLSample. Open Web Browser and input URL: http://serverName:9080/BTTHTMLSampleWeb/btt/html/sign/prepareSignIn.do