Migrating the Titan_Business Application from Sun Java System Application Server 7 to Sun Java System Application Server 8

Version 1.0

This document explains how to use the Migration Tool for Sun Java System Application Server 8 (hereafter called the Migration Tool) to migrate the Titan_Business application from the Sun Java System Application Server 7 source server to the Sun Java System Application Server 8 target server. The document also explains how to assemble, deploy, and run the sample application on the target server.

This document contains the following sections:

Overview
Prerequisites
Migrating the Application
Deploying and Running the Migrated Application on the Target Server

Overview

Titan_Business Overview briefly describes the Titan_Business sample application.


Prerequisites

The following section describes what you need to do before you begin this exercise.

Database Setup

The following sections provide step-by-step instructions for setting up a database to use with the Titan_Business example:


Migrating the Application

This section describes how to migrate the application from the source server (Sun Java System Application Server 7) to the target server (Sun Java Systems Application Server 8).

  1. Set the following environment variables that are used by the Migration Tool's build scripts:

    • JAVA_HOME: J2SE SDK 1.4 installation directory
    • J2EE_HOME: Sun Java Systems Application Server 8 installation directory
    • ASMT_HOME: Migration Tool installation directory
    • AS_HOME: bin directory of the Sun Java Systems Application Server 8 installation
    • CLASSPATH: Include any application-specific library classes that are required for compiling the application

  2. Start the Migration Tool in GUI mode:
  3. On Solaris:

      <ASMT_HOME>/bin> sh asmigrate.sh -u

    On Windows:

      <ASMT_HOME>\bin> asmigrate -u

    Invoking the Migration Tool in Command-Line Mode explains how to run the Migration Tool in command-line mode.

  4. Specify the Source Application (Input) details:

    1. Select "Source" and specify the directory <ASMT_HOME>/examples/S1AS_7_0/titan_business as input to the Migration Tool.

    2. Select the Source Server as Sun Java System Application Server 7 from the dropdown list.

  5. Specify the Target Application (Output) details:

    1. Specify a Directory path of your choice to the location where the migrated output application should be written. From here on, this document will refer to this directory path as <OUTPUT_DIR>.

    2. Select the Target Server from the dropdown list. Your only choice is Sun Java Systems Application Server 8.

  6. Press the Migrate button.

    The Migration Tool creates a directory structure that contains the migrated source files and generated build scripts in the output directory that you selected.

  7. Change to the <OUTPUT_DIR>/titan_business/src directory and run the appropriate build script to generate the cmr2.ear file:

    • On Solaris: sh build_ear.sh

    • On Windows: build_ear

    The build script generates the <OUTPUT_DIR>/titan_business/src/asmtbuild/cmr2.ear file, which you will deploy on the target server.



Deploying and Running the Migrated Application on the Target Server

  1. Configure database connectivity for Application Server 8, the target server.

    Before you begin these steps, make sure that the domain to which the application will be deployed is in the running state. These instructions assume that the application will be deployed to the default domain, domain1.

    Use the asadmin utility in the Application Server 8 bin directory to:

    1. Add a connection pool:
        asadmin create-jdbc-connection-pool 
         --user  admin_user 
         --password admin_password 
         --host localhost 
         --port  4848 
         --datasourceclassname dsclassname  
         --property User=cmr:Password=cmr:URL_PROP=db_url CMRPool

      Replace the variables shown in a blue font with values appropriate for your own environment.

      dsclassname should be:

      • oracle.jdbc.pool.OracleDataSource for Oracle
      • com.pointbase.jdbc.jdbcDataSource for PointBase

      URL_PROP should be:

      • url for Oracle
      • DatabaseName for PointBase

      db_url should be:

      • jdbc:oracle:thin:@ORACLE_HOST:1521:SID for Oracle, where ORACLE_HOST is the machine name/IP address on which the database is installed, and SID is the System ID of the Oracle database.

      • jdbc:pointbase:server://POINTBASE_HOST:9092/migration-samples for Pointbase, where POINTBASE_HOST is the machine name/IP address on which the database is installed. This will be localhost in most cases.

      Note: You must escape all of the ":" characters in the URLs listed above with a double backslash ("\\") on Solaris and a single backslash ("\") on Windows to avoid errors while running the create-jdbc-connection-pool command.

    2. Add a JDBC resource:
        asadmin create-jdbc-resource 
         --user admin_user 
         --password admin_password 
         --host localhost 
         --port 4848 
         --connectionpoolid CMRPool jdbc/cmr

      Replace the variables shown in a blue font with values appropriate for your own environment.

    3. Add a persistence manager:
        asadmin create-persistence-resource 
         --user admin_user 
         --password admin_password 
         --host localhost 
         --port 4848 
         --jdbcjndiname jdo/pmfPM 
         --factoryclass com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl 
         jdo/pmf

      Replace the variables shown in a blue font with values appropriate for your own environment.

    4. Add another JDBC resource:
        asadmin create-jdbc-resource 
         --user admin_user 
         --password admin_password 
         --host localhost 
         --port 4848 
         --connectionpoolid CMRPool jdo/pmfPM

      Replace the variables shown in a blue font with values appropriate for your own environment.

    5. Modify the target server's classpath.

      Note: Complete this step only if you are using the Oracle database. The driver class for PointBase is already in the server classpath.

      1. Add the JDBC driver classes to the server classpath:

        1. Get the current classpath prefix of the domain:
            asadmin get --user admin_user 
             --password admin_password 
             --host localhost 
             --port 4848 
             server.java-config.classpath_prefix

          Replace the variables shown in a blue font with values appropriate for your own environment.

          Write down the prefix. For this example, assume that the classpath prefix is CLASSPATH.


        2. Set the classpath to include the Oracle driver classes:
            asadmin set --user admin_user
             --password admin_password 
             --host localhost
             --port 4848
             server.java-config.classpath_prefix=CLASSPATH${path.separator}PATH_TO_DRIVER_CLASSES

          Replace the variables shown in a blue font with values appropriate for your own environment.

          The PATH_TO_DRIVER_CLASSES variable points to the location of classes12.zip, the driver classes for the Oracle database.

      2. Follow the instructions in the previous step to add the asmt-rt.jar file, which is located in the <ASMT_HOME>/lib directory, to the server's classpath.

      Note: See the Preparing the Sun Java Systems Application Server 8 to Run the Migrated Applications section for additional information.

  2. Restart the server:
      asadmin stop-domain
      asadmin start-domain
  3. Deploy the application:
      asadmin deploy --user admin_user 
       --password admin_password 
       --host localhost 
       --port 4848 
       <OUTPUT_DIR>/titan_business/src/asmtbuild/cmr2.ear

    Replace the variables shown in a blue font with values appropriate for your own environment.

  4. Run the application:

    1. Run the deployed Titan_Business application by accessing the following URL:
        http://localhost:<port>/customer
    2. This page shows a list of JSP files. Invoke the following:
      • Client_75.jsp
      • Client_76a.jsp
      • Client_76b.jsp
      • Client_77a.jsp
      • Client_77b.jsp
      • Client_77c.jsp
      • Client_77d.jsp

      Each of these JSPs shows a particular type of CMR. The JSPs that you did not invoke are helpers, which show no meaningful output of their own.

      After you invoke a JSP, press the "Delete All Rows of All Tables" button at the bottom of each JSP display to empty the database tables before you reinvoke the JSP. If you do not, an error will occur.


Index
Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved.