WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

Package examples.iiop.ejb.stateless.server.wls

This example demonstrates using a variety of clients to call a stateless EJB through a Tuxedo Server or directly through WebLogic.

See:
          Description

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

Class Summary
TraderBean TraderBean is a stateless Session Bean.
TradeResult This class reflects the results of a buy/sell transaction.
 

Package examples.iiop.ejb.stateless.server.wls Description

This example demonstrates using a variety of clients to call a stateless EJB through a Tuxedo Server or directly through WebLogic. Also it demonstrates passing server-to-server information using the underlying WebLogic Tuxedo Connector in conjunction with a Tuxedo client. This specific package contains the necessary files to build the EJB used in these examples. You must first build the EJB before you can execute any of the clients, or run the Tuxedo server.

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

Description

This example illustrates how to call a stateless session bean from a variety of client applications using RMI-IIOP. It uses Inprise Visibroker 4.1 for C++. If you wish to run any of the Tuxedo clients or Tuxedo Servers, you must have Tuxedo 8.0 or later. These examples use 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.

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. 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.

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

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

Build the EJB and set up your WebLogic Server

  1. Set up your development shell as described in Setting up your environment.

  2. There is an iiop.properties file contained in the WL_HOME\samples\examples\iiop directory. This file must point to your installation of Visibroker. For example: INPRISE_HOME=c:/Inprise/vbroker

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

    1. Create the build directory, and copy the deployment descriptors into it as shown in this example for Windows NT/2000:

      $ mkdir build build\META-INF build\images

      $ copy *.xml build\META-INF

      $ copy *.gif build\images

    2. Compile ejb classes into the build directory (jar preparation)

    3. Make a EJB jar file, including XML deployment descriptors. 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.

    4. Run ejbc on the jar file. Notice the use of the -iiop option.

    5. Compile EJB interfaces & client application into the clientclasses directory contained in the examples domain (WL_HOME/config/examples/examples/clientclasses).

  4. Note: Running the build script places the EJB in %WL_HOME%\config\examples\applications directory, where it automatically deploys once the server is started. If you are already running the server and build another EJB, it is automatically placed in this directory and instantly deployed.

    Additional information on using the build scripts is found in Building Enterprise JavaBean examples

Configure the server

  1. Start the server with the examples configuration.

  2. Make sure that the EJB has been deployed on your examplesServer.

  3. Bring up the Administration Console in your browser.

    1. Click to expand the Deployments node in the left-hand pane.
    2. Click to expand the EJB node in the left-hand pane.
    3. Select the iiop_ejb_stateless node.
    4. Select the Targets tab in the right-hand pane to display the Available and Chosen targets.
    5. The EJB should be deployed

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++ CORBA Client (requires visibroker 4.1)

    Tuxedo CORBA Client (requires Tuxedo 8.0)

    Also, you can run the Tuxedo client through the Tuxedo Server as well as make outbound calls form WebLogic to Tuxedo with each client:

    Tuxedo Server

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.