Migrating the HelloDB Application from Sun ONE Application Server 6.x 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 HelloDB application from the Sun ONE Application Server 6.x 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

HelloDB Overview briefly describes the HelloDB 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 HelloDB example:


Migrating the Application

This section describes how to migrate the application from the source server (Sun ONE Application Server 6.x) 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/ias_6_x/hellodb as input to the Migration Tool.

    2. Select the Source Server as Sun One Application Server 6.5 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>/hellodb/src directory and run the appropriate build script to generate the HelloDatabase.ear file:

    • On Solaris: sh build_ear.sh

    • On Windows: build_ear

    The build script generates the <OUTPUT_DIR>/hellodb/src/asmtbuild/HelloDatabase.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=ibank_user:Password=ibank_user:URL_PROP=db_url HelloDBPool

      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 HelloDBPool jdbc/hellodb/HelloDbDB

      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 
         --connectionpoolid 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 HelloDBPool 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

          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

          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 to use the changes:
      asadmin stop-domain
      asadmin start-domain
  3. Deploy the application:
      asadmin deploy --user admin_user 
       --password admin_password 
       --host localhost 
       --port 4848 
       <OUTPUT_DIR>/hellodb/src/asmtbuild/HelloDatabase.ear

  4. Run the application:

    1. Run the deployed HelloDB application by accessing the following URL:
        http://localhost:<port>/hellodb

    2. When prompted, enter "jatkins" for the username and "monday" for the password.


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