WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

Package examples.wtc.corba.simpappcns

This example demonstrates the ability to use WTC to allow Tuxedo or WLS clients to run CORBA applications.

See:
          Description

Interface Summary
ToupperCorba The methods in this interface are the public face of the simpapp client.
ToupperCorbaHome This interface is the home interface for the ToupperCorbaBean.java, which in WebLogic is implemented by the code-generated container class ToupperCorbaBeanC.
 

Class Summary
Client This class illustrates calling a stateful SessionBean and performing the following exercises: Create a ToupperCorba Convert a string using ToupperCorba Remove the ToupperCorba
ToupperCorbaBean ToupperCorbaBean is a stateful SessionBean.
 

Package examples.wtc.corba.simpappcns Description

This example demonstrates the ability to use WTC to allow Tuxedo or WLS clients to run CORBA applications.

The simpappcns example takes the Tuxedo 8.0 CORBA cnssimpapp application and extends it to run over domains, such that the clients for the to_upper method can either run on Tuxedo or on WLS.

This example uses two domains:

  • The classical TUXEDO domain is called TUXDOM
  • A WLS domain called examples

  • The classical TUXEDO domain is called TUXDOM
  • A WLS domain called examples

    Configure the example

    You need to configure Tuxedo and WLS.

    Tuxedo configuration

    1. Create a working directory containing the cnssimpapp example. Copy the TUXEDO CORBA cnssimpapp example from your Tuxedo installation and place it in your working cnssimpapp directory. Make sure the qualified path name and file name for the tuxconfig file contains less that 64 characters.

    2. Set environment variables. Update the following parameters:
      • TUXDIR - base directory of the TUXEDO Software
      • APPDIR - base directory of the sample program
      • PATH - must include %TUXDIR%\bin
      • TUXCONFIG - full pathname of binary tuxconfig file
      • TOBJADDR - hostname and port of the Tuxedo Object
      NT/2000 users modify setEnv.cmd located at %TUXDIR%. Unix users modify the tux.env file located at $TUXDIR.

    3. Build the clients:
        NT/2000 users enter the following command: nmake -f makefile.nt all
        Unix users enter the following command: nmake -f makefile.mk all

    4. Copy the files ubbdomain and dom1config from the WL_HOME/samples/server/src/examples/wtc/corba/simpappcns directory. Paste them into your working cnssimpapp directory.

    5. Modify the ubbdomain for your Tuxedo environment. This includes setting the pathnames for APPDIR, TUXCONFIG, and TUXDIR and setting the machine name. Replace all <bracked> items with information for your environment.
        Example:
        APPDIR="my_apps/cnssimpapp"
        TUXCONFIG="my_apps/cnssimpapp/tuxconfig"
        TUXDIR="bea/tuxedo8.0"
        Update the ILS section with the TOBJADDR from your Tuxedo environment.

    6. Modify the dom1config for your Tuxedo environment. This includes creating log devices and updating the network addresses.
      • Logs
        Example:
        DMTLOGDEV="d:\my_apps\cnssimpapp\DMTLOG"
        DMTLOGNAME="DMTLOG_TUXDOM"
      • NWADDR
        Example:
        TDOM1 NWADDR="//Machine:1234"
        examples NWADDR="//Machine:5678"

    7. Load the ubbdomain file
        Example:
        tmloadcf -y ubbdomain

    8. Set the location of your bdmconfig file and load the dom1config file
        Example:
        set BDMCONFIG=my_apps\cnssimpapp\bdmconfig
      then:
        dmloadcf -y dom1config

    9. Boot the Tuxedo domain
        tmboot -y

    10. Verify your Tuxedo configuration by running a remote client using the following command:
        simple_client -ORBid BEA_IIOP
      You should be prompted for a string. A Tuxedo process will convert the string to all capital letters.
        String? hello world
      You should recieve the following messages:
        HELLO WORLD
        hello world

    11. If you recieve the following message, close this shell, open a new Tuxedo shell, and go to step 1.
        Error connecting to Tuxedo Domain

    WLS Configuration

    1. Boot your WebLogic Examples Server
      • Make sure that no other WTCServer Mbeans are targeted to the examplesServer
    2. Change directories to the WTC simpappcns directory
    3. Set environment variables. Update the following parameters:
      • Set the APPLICATIONS to the location of the applications directory in your WLS domain
      • Set the CLIENT_CLASSES to build
      NT/2000 users modify and run the setExamplesEnv.cmd. Unix users copy ./config/examples/setExamplesEnv.sh script to your WTC simpappcns directory, then modify and run the setExamplesEnv.sh script.
    4. Build the wtc_toupper_corba.jar file using ant.
      • Enter the following command: ant
    5. Modify the setWTCMbeans file with information specific to your installation.
      • NT/2000 users modify the setWTCMbeans.cmd file. Unix users modify the setWTCMbeans.sh file.
      • Update the NWAddr attributes of TDOM1 and TDOM2 domains for your environment
      • Set the user and passwd for your environment
    6. Run the setWTCMbeans file to configure your installation.
      • NT/2000 users run the setWTCMbeans.cmd file.
      • Unix users run the setWTCMbeans.sh file.
    7. Check to see that the wtc_toupper_corba.jar is deployed. Use the WLS console or check the config.xml file. Manually deploy the EJB if needed.

    Run the example

    Start a WLS client which connects to the Tuxedo CORBA application and invokes to_upper.

    From the WTC simpappcns directory, start a client

    The service returns the following:

    Beginning statefulSession.Client...
    Creating ToupperCorba
    converting HereIsAString
    converted to: HEREISASTRING
    End statefulSession.Client...

  • Untarget the WTCsimpappcns Mbean from the examplesServer.

    Use TraceLevel

    If you have a problem running the simpappcns example, use the WTC tracing feature. Add the TraceLevel attribute to your startWebLogic script.
    Example:
       -Dweblogic.wtc.TraceLevel=100000
    A TraceLevel of 100000 traces all of the calls to the Tuxedo object in the client.

    There's more....

    For more information about WebLogic Server WebLogic Tuxedo Connector, see:


    Documentation is available at
    http://e-docs.bea.com/wls/docs70

    Copyright © 2002 BEA Systems, Inc. All Rights Reserved.