Sun Java System Application Server 

Samples Index

The Stateful Simple EJB Cart Sample Application

This sample application demonstrates a stateful session Enterprise JavaBean (EJB) . The sample consists of an EJB component and a Java application client. The session bean, CartEJB, represents a shopping cart in an online bookstore. The bean's client can add a book to the cart, remove a book, or retrieve the cart's contents.

The general instructions for building, deploying, and running sample applications are provided in Building, Deploying, and Running Sample Applications. In reading this document, use the following application-specific variables for this application:

Follow this general procedure:

  1. Build the Application. The build file, build.xml, is in the app_dir directory, specifically, install_dir/samples/ejb/stateful/apps/simple.
  2. Deploy the Application. The EAR file is install_dir/samples/ejb/stateful/apps/simple/stateful-simple.ear.
  3. Run the application client following the instructions in the next section

Running the Application

This application has no web client, so to run it you must run the application client. Follow these steps:

  1. In a shell window, make your working directory be the directory where the application is deployed:
    cd domain_root_dir/domain_name/samples/ejb/stateful/apps/simple
  2. Run the application client by entering the following command:
    appclient -client stateful-simpleClient.jar -name CartClient -textauth

You will see the following output:

...

The Martian Chronicles

2001 A Space Odyssey

The Left Hand of Darkness

Caught a BookException: Alice in Wonderland not in cart

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.