WebLogic Server 6.1 Beta Code Examples, BEA Systems, Inc.

Package examples.iiop.ejb.stateless.server.tux

This example illustrates how to call a stateless session bean from a variety of client applications through a Tuxedo Server. In conjunction with the Tuxedo Client, it also can demostrate server-to-server connectivity using the underlying WebLogic-Tuxedo-Connector technology. Make sure you have deployed the bean and run through the setup and configuration in WebLogic Server first.

Then after you have set up and run your Tuxedo Server as described in this document, try the different clients:

  • RMI Client

  • C++ Client (requires visibroker 4.1)

  • Tuxedo Client (requires Tuxedo 8.0)

    Note: If you are a Unix user and wish to run through Tuxedo you must have Tuxedo 8.0 with rolling patch #10. And for SunOS users you must have the Sun Workshop 6.0 with 5.1 C compiler.

    Also, if you are interested in how Tuxedo and Corba clients call an EJB on WebLogic, is recommended to use this example as reference, rather than the WLStrader example included in the Tuxedo 8.0 distribution.

    This example uses a stateless session EJB called TraderBean and presumes some knowledge of EJB deployment. For examples pertaining strictly to EJBs, please see our EJB examples page. Included there is a stateless session bean similar to TraderBean. This example also presumes familiarity with BEA Tuxedo. For further information on Tuxedo and especially how to administer and configure a Tuxedo Server, it is highly recommended that you view their online documentation

    To get the most out of this example, first read through the source code files to see what is happening. Start with the XML deployment files to find the general structure of the EJB, i.e. which classes are used for the different objects and interfaces, then examine the other files to see how the applications work. Pay close attention to setting up your Tuxedo environment as there are many pitfalls when attempting to run Tuxedo and WebLogic in conjunction. There are three different clients that can be executed to call the EJB. Examine the XML build file carefully for each one. Take special note to see how the idl files are created for the C++ and Tuxedo clients as well as the Tuxedo server.

    If you run into problems, make sure to check your environment; check especially your PATH and CLASSPATH as well as the BDMCONFIG, TOBJADDR , and TUXCONFIG variables that are used by Tuxedo. Make sure you have the proper settings that include the necessary Tuxedo directories in your PATH; make sure you have TUXDIR set to your installation of Tuxedo 8.0 and that you have included the tuxedo8.0/bin and tuxedo8.0/lib directories in your PATH. It is recommended to get these examples first working with WebLogic Server before attempting to introduce the Tuxedo Server.

    The following section describes how to build and run the example:

    1. Build the example
    2. Configure the server
    3. Run the example

    Before you start

    Build the trader_server executable

    1. Make sure you have built the Bean and executed the build script as per the iiop/ejb/stateless/server/wls instructions. It is necessary that you successfully build this part of the example first before running through Tuxedo or continuing with any of the steps below.

    2. Set up your WLS development shell as described in Setting up your environment. Make sure that you have tuxedo8.0/bin in your PATH.

    3. Execute the build.xml script provided for this example in the samples\examples\iiop\ejb\server\tux directory of your WebLogic Server installation. The script will perform the following steps:

    1. Run ejbc on the jar file. Notice the use of -iiop -idl -idlOverwrite -idlDirectory.

    2. Compile the application and output a single executable, trader_server.exe.

    Set up the example

    1. Modify the bdmconfig.xml file that is included in the WL_HOME/samples/examples/iiop/ejb/stateless/server/tux directory. This file configures the WebLogic-Tuxedo-Connector. In both T_DM_LOCAL_TDOMAIN and in T_DM_REMOTE_TDOMAIN replace 127.0.0.1 with your own ip address in the NWADDR sections.

    2. Configure a WTC StartUp Class. You can do this through the console or by adding an entry to your examples WL_HOME/config/examples/config.xml file. You need to provide a classname and the fully qualified name of the bdmconfig.xml file you are using for the example.
      • Set the classname to: weblogic.wtc.gwt.WTCStartup
      • Set the arguments field to: BDMCONFIG=path_name_of_your_bdmconfig.xml_file

      For example, your config.xml would have an entry like the following:

      
      <StartupClass
              Arguments="BDMCONFIG=c:\BEA_HOME\wlserver6.1\samples\examples\iiop\ejb\stateless\server\tux\bdmconfig.xml"
              ClassName="weblogic.wtc.gwt.WTCStartup" Name="bdmconfig" Targets="examplesServer"/>
          

    3. Boot your WebLogic Examples Server

    4. Check to see that the iiop_ejb_stateless.jar is deployed. Use the WLS console or check the config.xml file. Take special note of the <env-entry> in the ejb-jar.xml that contains the foreignOrb property; if you are using Tuxedo, this descriptor contains the address the bean will connect to when doing outbound calls.

    Set up Tuxedo

    1. Go to your <TUXDIR>/samples/corba/cnssimpapp directory and run runme.cmd, this will verify that you Tuxedo installation is correct and builds an example. There is documentation for this example included in it's own directory. For additional information on Tuxedo examples and setting up your Tuxedo environment, see the Tuxedo documentation.

    2. Set up your Tuxedo development shell. When you run runme.cmd your environment will be set. Check the following parameters:

      • TUXDIR - base directory of the TUXEDO Software
      • APPDIR - base directory of the sample program (cnssimpapp in this case)
      • PATH - must include %TUXDIR%\bin
      • TUXCONFIG - full pathname of binary tuxconfig file

      NOTE: NT/2000 users may modify the setEnv.cmd script included with the cnssimpapp Tuxedo example that is placed in the cnssimpapp/results directory. Unix users may modify the tux.env file.

    3. Copy the files cpp/trader_server.exe, ior.txt, ubbdomain, and dom1config from the WL_HOME/samples/examples/iiop/stateless/ejb/server/tux directory (note that trader_Server.exe was placed one directory down in the cpp folder). Paste all the files into the <TUXDIR>/samples/corba/cnssimpapp directory. If you are a Unix user, change the name of trader_server.exe to trader_server without an extension.

    4. Modify the ubbdomain file that you just copied into Tuxedo for your Tuxedo environment. Modify the MACHINES section of the UBBDOMAIN file to reflect your machine name (change <HOSTNAME> to whatever your machine name is). Change the 127.0.0.1 entry next to CLOPT in the ISL section to be your own ip address. Also check the pathnames for APPDIR, TUXCONFIG, and TUXDIR in the MACHINES section. Make sure all the <bracked> items below contain the correct path to you Tuxedo home. Then save the file.

        APPDIR="<TUXDIR>/samples/corba/cnssimpapp"
        TUXCONFIG="<TUXDIR>/samples/corba/cnssimpapp"
        TUXDIR="<TUXDIR>"

    5. Load the ubbdomain file. Example:

        tmloadcf -y ubbdomain

    6. Modify the dom1config file that you copied into your Tuxedo directory. In the *DM_TDOMAIN section, replace the two 127.0.0.1 ip addresses with your own ip address. Then save the file.

    7. Set the location of your bdmconfig file. This is not to be confused with the bdmconfig.xml file that configures the WebLogic side of Tuxedo-WebLogic communication. The Tuxedo bdmconfig file is simply the remote domain configuration file for Tuxedo that has been loaded and compiled into binary format from the (dom1config file that you have just set up. The bdmconfig file (here named bdmconfig) should begin as a blank unformatted file. To set up the bdmconfig and load the dom1config file, for example:

        set BDMCONFIG=<TUXDIR>\samples\corba\cnssimpapp\results\bdmconfig

      then:

        dmloadcf -y dom1config

    8. Boot the Tuxedo domain

        tmboot -y

    9. Make sure TOBJADDR is set correctly in your environment. For instance to //<hostname>:2468

    10. Register WLS in the CosNaming namespace by doing:

        c:/tuxedo8.0/smaples/corba/cnssimpapp>cnsbind -o ior.txt WLS

    Run the example

      There are three different client applications included in this example. Each requires different steps to build and execute. The following links contain information pertinent to each respective client.

      RMI Client

      C++ Client (requires visibroker 4.1)

      Tuxedo Client (requires Tuxedo 8.0)

    Use TraceLevel

    If you have problems running the ejb.stateless.server.tux examples, use the WebLogic Tuxedo Connector tracing feature. Add the TraceLevel parameter to the StartUp Class Argument list.
    Example:
       BDMCONFIG=path_to_my_bdmconfig.xml_file,TraceLevel=65000
    A TraceLevel of 65000 traces all of the calls to the CORBA object in the client.

    There's more...

    Read more about WebLogic RMI over IIOP in the Developer Guide, Using WebLogic RMI over IIOP.

    Read more about WebLogic EJB in the Developer Guide, BEA WebLogic Server Enterprise JavaBeans.

    Read more about WebLogic RMI in the Developer Guide, Using WebLogic RMI.

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


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

    Copyright © 2001 BEA Systems, Inc. All rights reserved.