WLEC to WebLogic Tuxedo Connector Migration Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

How to Modify the Tuxedo CORBA Simpapp Example

The following section provides an example of how to convert a WLEC application to use WebLogic Tuxedo Connector. This example provides information on the steps required to convert the WebLogic Server 6.1 examples\wlec\ejb\simpapp example to work using the WebLogic Tuxedo Connector. A complete migrated FactoryFinder example is available from the BEA dev2dev code library. Review the Prerequisitesbefore proceeding.

 


How to Modify the Tuxedo Environment

This section provides information on how to modify the Tuxedo configuration files to use with WebLogic Tuxedo Connector.

Run the Tuxedo CORBA Simpapp Example

You should run the Tuxedo CORBA simpapp example to verify your Tuxedo environment and prepare to run the WLEC simpapp application.

Use the following steps to run the Tuxedo example located at $TUXDIR/samples/corba/simpapp:

  1. Create a working copy of the Tuxedo CORBA simpapp example. Copy the Tuxedo CORBA simpapp example from your Tuxedo installation and place it in your working simpapp directory.
  2. Change directories to your working simpapp directory.
  3. Build and run the example.
    1. Set your Tuxedo environment. Windows users set %TUXDIR% in your shell environment. Unix users need to set the Tuxedo environment by running $TUXDIR/tux.env.
    2. Make sure the C++ compiler is in your PATH.
    3. Set the JAVA_HOME environment variable to the location of your Tuxedo Java JDK.
    4. Set the environment by running the runme script. This will create the client stubbs that provide the programming interface for CORBA object operations. A results directory is created in your working directory that contains the files used to configure the Tuxedo environment.
    5. Run the Java client.
    6. java -DTOBJADDR=%TOBJADDR% -classpath %CLASSPATH% SimpleClient
    7. Shutdown the Tuxedo server.
    8. tmshutdown -y

Modify the UBB Configuration File

In your working Tuxedo simpapp directory, use the following steps to modify your UBB configuration:

  1. Rename the results/ubb file in your working directory as results/ubbdomain.
  2. Edit the ubbdomain file using a text editor, such as vi or WordPad.
  3. Add Tuxedo gateway servers to the *SERVERS section.
  4. Example: Add the following servers.

         DMADM SRVGRP=SYS_GRP SRVID=7
         GWADM SRVGRP=SYS_GRP SRVID=8
         GWTDOMAIN SRVGRP=SYS_GRP SRVID=9
  5. Save the ubbdomain file.

The following code is an example of a modified ubbdomain file. Changed sections are marked in bold.

Listing 3-1 Modified UBB File
*RESOURCES
     IPCKEY 55432
     DOMAINID simpapp
     MASTER SITE1
     MODEL SHM
     LDBAL N
*MACHINES
     "balto"
     LMID = SITE1
     APPDIR = "/tux_apps/corba/simpapp"
     TUXCONFIG = "/tux_apps/corba/simpapp/results/tuxconfig"
     TUXDIR = "/my_machine/tux/tuxedo8.1"
     MAXWSCLIENTS = 10
*GROUPS
     SYS_GRP
     LMID = SITE1
     GRPNO = 1
     APP_GRP
     LMID = SITE1
     GRPNO = 2
*SERVERS
     DEFAULT:
     RESTART = Y
     MAXGEN = 5
     TMSYSEVT
SRVGRP = SYS_GRP
     SRVID = 1
TMFFNAME
     SRVGRP = SYS_GRP
     SRVID = 2
     CLOPT = "-A -- -N -M"
TMFFNAME
     SRVGRP = SYS_GRP
     SRVID = 3
     CLOPT = "-A -- -N"
TMFFNAME
     SRVGRP = SYS_GRP
     SRVID = 4
     CLOPT = "-A -- -F"
simple_server
     SRVGRP = APP_GRP
     SRVID = 1
     RESTART = N

# The ISL handler is not needed for WTC.
# If you do not need it for other WLEC applications,
# it can be removed.
ISL
     SRVGRP = SYS_GRP
     SRVID = 5
     CLOPT = "-A -- -n //mymachine:2468 -d /dev/tcp"
DMADM
     SRVGRP = SYS_GRP
     SRVID = 7
GWADM
     SRVGRP = SYS_GRP
     SRVID = 8
GWTDOMAIN
     SRVGRP = SYS_GRP
     SRVID = 9
*SERVICES

Create a Domain Configuration

In your working Tuxedo simpapp directory, use the following steps to create a domain configuration:

  1. Create a domain configuration file using a text editor, such as vi or NotePad. The simplest method is to cut and paste the dmconfig code example into your editor.
  2. Replace all <bracketed> items with information for your environment.
  3. Listing 3-2 dmconfig File
         *DM_RESOURCES
         VERSION=U22
         *DM_LOCAL_DOMAINS
         TUXDOM     GWGRP=SYS_GRP
                    TYPE=TDOMAIN
                    DOMAINID="TUXDOM"
                    BLOCKTIME=20
                    MAXDATALEN=56
                    MAXRDOM=89
                    DMTLOGDEV="<Path to domain TLOG device>"
                    DMTLOGNAME="DMTLOG_TUXDOM"
         *DM_REMOTE_DOMAINS
              examples TYPE=TDOMAIN DOMAINID="examples"
         *DM_TDOMAIN
              TUXDOM NWADDR="<network address of Tuxedo domain>"
              examples NWADDR="<network address of WTC domain>"
         *DM_REMOTE_SERVICES
  4. Save the file as dmconfig in your working simpapp/results directory.

Test the Tuxedo Environment

Use the following steps to validate your Tuxedo configuration:

  1. In a new shell, change directories to your working simpapp/results directory.
  2. Set the environment using the setenv script for your platform.
  3. Load the ubbdomain file:
  4. tmloadcf -y ubbdomain
  5. .Load the dmconfig file:
  6. set BDMCONFIG=<path_to_your_working_simpapp_example>/simpapp/results/bdmconfig
    dmloadcf -y dmconfig
  7. Boot the Tuxedo domain
  8. tmboot -y
  9. Verify the Tuxedo environment.
  10. java -DTOBJADDR=%TOBJADDR% -classpath %CLASSPATH% SimpleClient
  11. Shutdown the Tuxedo server.
  12. tmshutdown -y

 


Modify the ejb-jar.xml File

Use a text editor such as Vi or Notepad to remove connection pool descriptors and update the trans-attribute. The following listing provides a code example on how to remove references to the IIOP connection pool descriptors in the WLEC simpapp example ejb-jar.xml.

 


Update the build.xml File

A build.xml file is presented below to simplify compiling and deploying your migrated application in the Weblogic environment. Use the following example code to replace the contents of the build.xml file.

Listing 3-4 Updated build.xml file
<project name="wlec-ejb-simpapp" default="all" basedir=".">

<!-- set global properties for this build -->
<property environment="env"/>
<property file="../../../../examples.properties"/>
<property name="build.compiler" value="${compiler}"/>
<property name="source" value="."/>
<property name="build" value="${source}/build"/>
<property name="dist" value="${source}/dist"/>
<property name="ejb_classes" value="Converter.java, ConverterHome.java, ConverterResult.java,
ProcessingErrorException.java, ConverterBean.java"/>
<property name="ejb_jar" value="wlec_simpapp_corba.jar"/>
<property name="client_classes" value="Converter.java, ConverterHome.java, ConverterResult.java,
ProcessingErrorException.java, Client.java"/>

<target name="all" depends="clean, init, compile_idl, compile_ejb, jar_ejb, appc, compile_client"/>

<target name="init">
<!-- Create the time stamp -->
     <tstamp/>
     <!-- Create the build directory structure used by compile
     and copy the deployment descriptors into it-->
     <mkdir dir="${build}"/>
     <mkdir dir="${build}/META-INF"/>
     <mkdir dir="${dist}"/>
     <copy todir="${build}/META-INF">
     <fileset dir="${source}">
     <include name="*.xml"/>
     <exclude name="build.xml"/>
     </fileset>
     </copy>
     </target>

<!-- Compile IDL stub classes into the build directory (jar preparation) -->
<target name="compile_idl">
     <exec executable="idlj" dir=".">
     <arg line="-td build -pkgPrefix Simple simple -pkgPrefix      SimpleFactory simple simple.idl" />
     </exec>
     <javac srcdir="${build}" destdir="${build}"
     classpath="${CLASSPATH};${build}"/>
     <delete>
     <fileset dir="${build}">
     <include name="*.java"/>
     </fileset>
     </delete>
     </target>

<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb">
     <javac srcdir="${source}" destdir="${build}"
     includes="${ejb_classes}"
     classpath="${CLASSPATH};${build}"/>
     </target>

<!-- Make a standard ejb jar file, including XML deployment descriptors -->
<target name="jar_ejb" depends="compile_ejb">
     <jar jarfile="${dist}/std_${ejb_jar}"
     basedir="${build}">
     </jar>
     </target>

<!-- Run appc to create the deployable jar file -->
     <target name="appc" depends="jar_ejb">
<echo message="Generating container classes in ${apps.dir}/${ejb_jar}"/>
     <wlappc debug="${debug}"
     iiop="true"
     source="${dist}/std_${ejb_jar}"
     output="${apps.dir}/${ejb_jar}"
     />
     </target>

<!-- Compile EJB interfaces & client app into the clientclasses directory
-->
     <target name="compile_client">
     <javac srcdir="${source}"
     destdir="${client.classes.dir}"
     includes="${client_classes}"
     />
     </target>

<target name="run">
<java classname="examples.wlec.ejb.simpapp.Client">
</java>
</target>

     <target name="clean">
     <delete dir="${build}"/>
     <delete dir="${dist}"/>
     </target>
</project>

 


Modify the WLEC ConverterBean

The following listing provides a code example on how to modify the wlec/ejb/simpapp example ConverterBean.java file to interoperate with Tuxedo using WebLogic Tuxedo Connector.

 


Configure WebLogic Tuxedo Connector

Use the following steps to configure WebLogic Tuxedo Connector to connect WebLogic Server and the modified WLEC application:

  1. Create a WTC Service
  2. Create a Local Tuxedo Access Point
  3. Create a Remote Tuxedo Access Point
  4. Create an Imported Service

Create a WTC Service

Use the following steps to create and configure a WTC service using the WebLogic Server Administration Console:

  1. In the Administration Console, expand Interoperability and select WTC Servers in the navigation tree.
  2. On the WTC Servers page, click New.
  3. On the Create a New WTC Server page, enter My_WLEC_App to identify this configuration in the name field.
  4. Click OK.
  5. Your new WTC Service appears in the WTC Servers list.

Create a Local Tuxedo Access Point

Note: When configuring the Network Address for a local access point, the port number used should be different from any port numbers assigned to other processes. Example: Setting the Network Address to //mymachine:7001 is not valid if the WebLogic Server listening port is assigned to //mymachine:7001.

Use the following steps to configure a local Tuxedo access point:

  1. In the Administration Console, expand Interoperability and select WTC Servers.
  2. On the WTC Servers page, click the name of a WTC Service to access the settings page.
  3. Click the Local APs tab.
  4. Enter the following values for the following fields on the WTC Local Access Points page:
  5. In Access Point, enter My_Local_WLS_Dom.

    In Access Point Id, enter examples.

  6. In Network Address, enter the network address and port of the WebLogic Server environment that will host this local domain.
  7. Example: //my_WLS_machine:5678

  8. Click OK.

Create a Remote Tuxedo Access Point

Use the following steps to configure a remote Tuxedo access point:

  1. In the Administration Console, expand Interoperability and select WTC Servers.
  2. On the WTC Servers page, click the name of a WTC Service.
  3. Click the Remote APs tab.
  4. Enter the following values for the following fields on the WTC Remote Access Points page:
  5. In Access Point, enter My_WLEC_Dom.

    In Access Point Id, enter TUXDOM.

    In Local Access Point, enter My_Local_WLS_Dom.

  6. In Network Address, enter the network address and port of the Tuxedo environment that will host this remote domain.
  7. Example: //my_TUX_machine:5678

  8. Click OK.

Create an Imported Service

Use the following steps to configure an imported service:

  1. In the Administration Console, expand Interoperability and select WTC Servers.
  2. On the WTC Servers page, click the name of a WTC Service.
  3. Click the Imported tab.
  4. Enter the following values for the following fields on the WTC Imported Services page:
  5. In Resource Name, enter //simpapp.

    In Local Access Point, enter My_Local_WLS_Dom.

    In Remote Access Point List, enter My_WLEC_Dom.

    In Remote Name, enter //domain_id” where domain_id is DOMAINID specified in the Tuxedo UBBCONFIG file. The maximum length of this unique identifier for CORBA domains is 15 characters and includes the //.

    Example: //simpappff

  6. Click OK.

 


Run the simpapp Example

  1. Open a new shell and change directories to your working Tuxedo CORBA simpapp example.
  2. Set environment variables.
  3. NT\2000 users run the following command: results\setenv.cmd

    Unix users run the following command: results\setenv.sh

  4. Boot the Tuxedo domain
  5. tmboot -y
  6. Open a new shell and change directories to your WebLogic Server WLEC simpapp example.
  7. Set environment variables. Update the following parameters:
Note: NT/2000 users modify and run the setExamplesEnv.cmd. Unix users copy ./config/examples/setExamplesEnv.sh script to your WLEC simpapp directory, then modify and run the setExamplesEnv.sh script.
  1. Copy the simple.idl file from the Tuxedo CORBA simpapp example to your WebLogic Server WLEC simpapp example.
  2. Build the wlec_simpapp_corba.jar file using ant.
  3. Enter the following command: ant

  4. Use the WLS console to target My_WLEC_App to the server.
  5. Run the client.
  6. Enter the following command: ant run

The Java application generates the following output:

Beginning simpapp.Client...

Start of Conversion for: It Works

Converting to lower case: It Works

...Converted: it works

Converting to upper case: It Works
.
..Converted: IT WORKS

Removing Converter

End simpapp.Client...

If you have a problem running the example, use the WTC tracing feature. See Monitoring the WebLogic Tuxedo Connector.


  Back to Top       Previous  Next