WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

Package examples.wtc.atmi.qsample

This example demonstrates the ability to use WTC to allow Tuxedo or WLS clients to enqueue to the STRING queue in Tuxedo /Q.

See:
          Description

Interface Summary
Qsample The methods in this interface are the public face of the qsample client.
QsampleHome This interface is the home interface for the TraderBean.java, which in WebLogic is implemented by the code-generated container class TraderBeanC.
 

Class Summary
Client This class illustrates calling a stateful SessionBean and performing the following exercises: Create a Qsample Buy some shares using the Qsample Sell some shares using the Qsample Remove the Qsample
QsampleBean QsampleBean is a stateful SessionBean.
 

Package examples.wtc.atmi.qsample Description

This example demonstrates the ability to use WTC to allow Tuxedo or WLS clients to enqueue to the STRING queue in Tuxedo /Q.

This example uses two domains:

  • A Tuxedo domain called TDOM3
  • A WLS domain called TDOM2

    In order to enqueue messages across domains, the name of the Queue Space (QSPACE) is advertised as an imported service. The QSPACE service is offered by the TMQUEUE server in the Tuxedo domain.

    The sample /Q application is very similar to the application in qsample. It consists of a single server offering a single service, STRING, which converts a string from lower case to upper case. The service is called STRING. The client enqueues a request for this service. The request is placed on the request queue, STRING, by the TMQUEUE server. The request is handled by the TMQFORWARD server. This server removes the request from the request queue, sends it to the server for processing, and places the results on the reply queue, RPLYQ.

    Configure the example

    You need to configure Tuxedo and WLS.

    Tuxedo configuration

    1. Your PATH environment variable needs to include the path of your C compiler. Use set PATH to check the status and add the path if necessary.
    2. Copy the qsample example from your Tuxedo installation and create a working Tuxedo qsample directory
    3. Change directories to the working Tuxedo qsample directory
    4. 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
      NT/2000 users modify setEnv.cmd located at %TUXDIR%. Unix users modify the tux.env file located at $TUXDIR.
    5. Copy the makefile, ubb.sample and dom3config files from the WTC qsample directory to your Tuxedo qsample directory
    6. Modify the ubb.sample 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="/home/me/qsample"
        TUXCONFIG="/home/me/qsample/tuxconfig"
        TUXDIR="/usr/tuxedo"
        TLOGDEVICE="/home/me/qsample/TLOG"
    7. Modify the dom3config for your Tuxedo environment. This includes creating log devices and updating the network addresses.
      • Logs
        Example:
        DMTLOGDEV="d:\my_apps\tlog"
        AUDITLOG="d:\my_apps\aud"
        DMTLOGNAME="DMTLOG_TDOM3"
      • NWADDR
        Example:
        TDOM3 NWADDR="//TuxedoMachine:1234"
        TDOM2 NWADDR="//WTCMachine:5678"
    8. Build the clients:
      • NT/2000 users: nmake /f qsample.nt
      • Unix users:
        • Load the ubb.sample file
            Example:
            tmloadcf -y ubb.sample
        • Use makefile to build the client and server
        • Run crque to create the queue
        • Run crlog to create the transaction log
    9. Load the dom3config file
        Example:
        set BDMCONFIG=d:\mydomain\qsample\bdmconfig
        dmloadcf -y dom3config
    10. Boot the Tuxedo domain
        tmboot -y
    11. Verify all processes have started using the tmadmin psc command.The following domain processes should have booted:
      • DMADM, GWADM, and GWTDOMAIN
      • A QSPACE service offered by TMQUEUE

    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 qsample 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 qsample directory, then modify and run the setExamplesEnv.sh script.
    4. Build the wtc_qsample.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 TDOM3 and TDOM2 domains for your environment
      • If you are using a Tuxedo 6.5 service, add Interoperate and set to yes
      • 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_qsample.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 invokes the qsample EJB and connects to Tuxedo.
    1. Change directories to the WLS qsample directory
    2. Start a client
      • For NT/2000, use the following command: run.cmd allcaps
      • For Unix, use the following command: run.sh allcaps

      The service returns the following:

      Beginning statefulSession.Client...
      Creating trader
      converting allcaps
      converted to: ALLCAPS
      End statefulSession.Client...

    3. Untarget the WTCqsample Mbean from the examplesServer.

    Use TraceLevel

    If you have a problem running the qsample example, use the WTC tracing feature. Add the TraceLevel attribute to your startWebLogic script.
    Example:
       -Dweblogic.wtc.TraceLevel=20000
    A TraceLevel of 20000 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.