BEA Systems Logo Banner Arc  
  Stateless Session Bean Sample


Stateless Session Bean Sample

This sample demonstrates the usage of stateless session EJBs using a simple stock trader application. This sample demonstrates how the client must maintain any persistent state -- such as the change in the cash account -- across repeated calls to the session EJB. All the logic for the balance is encapsulated in the client, where all the persistence is provided by the container and the logic is maintained in the EJB.

The EJB in this sample provides basic trading methods such as buying and selling stocks. Since there are no persistent stores involved in this sample, all the stock data are set in the deployment descriptor of the EJB as environment properties. The container supplies the data to the EJB through JNDI lookup operation.

Main Directory Location

The following directory contains the Java source files and XML based deployment descriptors.

Windows NT:

$TUXDIR\samples\j2ee\ejb\basic\statelessSession 

UNIX:

$TUXDIR/samples/j2ee/ejb/basic/statelessSession 

A common build script is provided for all the EJB samples and it can be found in the following directory:

Windows NT:

$TUXDIR\samples\j2ee\ejb 

UNIX:

$TUXDIR/samples/j2ee/ejb 

Files

The following table lists and describes all the files for this sample application:

File Description

ejb-jar.xml

The XML deployment descriptor file used to help add the bean to the EJB container.

weblogic-ejb-extensions.xml

A file containing the WLE extensions to the deployment descriptor DTD

Client.Java

The Java source code for the client

TraderBean.java

The Java source code for the stateless session bean. This class contains the business logic method implementations and methods required by EJB 1.1 specification.

Trader.java

The Java source code for the Remote interface of the TraderBean class

TraderHome.java

The Java source code for the Home interface of the TraderBean class

TradeResult.java

Application-specific utility class used to carry a trade execution result between the EJB and the client.

ProcessingErrorException.java

Application-specific exception thrown by the TraderBean class for business methods.

Utility Files

The following table lists and describes the utility files for this sample application. These files are generated based on the WLE installation environment. Since a common build script is provided for all the EJB samples, instructions to build and execute the samples are provided later in Building and Running the EJB Sample Applications. The following files generated in the same directory as where the source files are found.

File Description

runme.cmd

The Windows NT batch file that contains commands to set the environment, boot the server, and execute the client for this sample

runme.ksh

The UNIX Korn shell script that contains commands to boot the server and execute the client for this sample

run_client.cmd

The batch file to run the client on Windows NT systems

run_client.ksh

The script file to run the client on UNIX systems

setenv.cmd

The batch file to set the necessary environment variables on Windows NT systems

setenv.ksh

The script file to set the necessary environment variables on UNIX systems

ubbconfig

The WLE server configuration file to be used on UNIX systems

ubbconfig.nt

The WLE server configuration file to be used on Windows NT systems

ejb_basic_statelessSession.jar

The ejb-jar file that contains the source file classes, the container-specific class files generated by the ejbc command, and the deployment descriptor files. This is the ejb-jar file that is deployed on the WLE server.

Building and Running the Sample Application

See the topic Building and Running the EJB Sample Applications for information about how to build and run the stateless session bean sample application.

Javadoc

The javadoc for the stateless session bean sample is available at the following location:

Package samples.j2ee.ejb.basic.statelessSession

 
 
    BEA Home | Corporate Info | News | Solutions | Products | Partners | Services | Events | Download | How to Buy
 Copyright © 1999, BEA Systems, Inc. All rights reserved.
 Contact BEAdocsupport@beasys.com