Skip navigation.

Smart Ticket Demo


These instructions provide steps for setting up and running the Java Smart Ticket demo on WebLogic Server 8.1. Smart Ticket is wireless client-server application for ordering movie tickets. It runs on a mobile device emulator that is included with J2ME (Java 2 Platform, Micro Edition), which you download in the course of this procedure. For a full description of Smart Ticket, see JavaTM Smart Ticket Sample Application.

Prerequisites

Before starting this demonstration, you need to have installed:

  • WebLogic Server 8.1
  • Oracle 9.2

    For information about configuring WebLogic Server to work with Oracle, see "Setting Up Examples to Run with an Oracle DBMS" in the examples directory of your WebLogic Server 8.1 installation (WL_HOME\samples\server\examples\src\examples\database_setup.html, where WL_HOME is the WebLogic Server installation directory).

Instructions

The instructions below describe how to download Smart Ticket and J2ME, how to create a WebLogic Server domain for Smart Ticket, and how to build and deploy the application.

Step 1: Download Smart Ticket and the Wireless Toolkit

Step 2: Create a Smart Ticket Domain

Step 3: Set Up Your Development Environment

Step 4: Build and Deploy Smart Ticket

Step 5: Use Smart Ticket

Step 1: Download Smart Ticket and the Wireless Toolkit

  1. Download the Smart Ticket 2.0 demo application source code at Sun's Web site: http://developer.java.sun.com/developer/releases/smarticket/. Extract it into a new directory, referred to in these instructions as SMARTICKET_HOME.
  2. Download the Sun J2ME Wireless Toolkit 2.0 at http://java.sun.com/products/j2mewtoolkit/download-2_0.html. Install the toolkit. During installation when you are prompted to point to a JDK, select the JDK included in your BEA_HOME/jdk141_03 directory, where BEA_HOME is the BEA installation directory that contains your WebLogic Server installation directory.
  3. Download smarticket_wls.zip from BEA. This patch provides the WebLogic Server descriptors that allow you to run the Smart Ticket Demo on WebLogic Server. Extract this ZIP file into the directory SMARTICKET_HOME/smart_ticket2.0ea.

Download Zip Application

Step 2: Create a Smart Ticket Domain

Create a new domain in WebLogic Server using the Configuration Wizard. (See Creating and Configuring Domains Using the Configuration Wizard for more information about the Configuration Wizard. ) The following steps will create a domain called smarticketDomain in WL_HOME\user_projects\domains. WL_HOME is the home location of your WebLogic installation, by default C:/bea/weblogic81.

  1. Start the Configuration Wizard. To start the Configuration Wizard using the Windows Start menu, select Programs->BEA WebLogic Platform 8.1->Configuration Wizard. To start it in a command window, change to the WL_HOME/common/bin directory and enter the command
    config.cmd (or .sh)
  2. In the Configuration Wizard, select "Create a New WebLogic Configuration" and click Next.
  3. Accept the default Basic WebLogic Server Domain template and click Next.
  4. Select the Custom configuration option and click Next.
  5. Give the server the name smarticketServer and click Next.
  6. In the Multiple Servers, Clusters, and Machines options, click Next to skip.
  7. In the Database (JDBC) options, click Yes to configure the database options.
  8. In Configure JDBC Connection Pools, click Add, provide the following settings:

    Name: oraclePool

    Vendor: Oracle

    Driver: Oracle's Driver (Thin) Versions: 8.1.7, 9.0.1, 9.2.0

    Dbms Name: ora920

    Provide the information from your Oracle configuration: your DBMS Host and Port, and your Oracle user name and password, and then click Next.
  9. In Configure JDBC MultiPools, click Next.
  10. In Configure JDBC Data Sources, click Add to add the following data source information, and then click Next:

    Name: MyDataSource

    JNDI Name: MyDataSource

    Pool Name: oraclePool

  11. In Test JDBC Connection Pools and Setup JDBC Database, click Test Connection. After successful test resulting in the following message click Next:

    Testing Connnection...

    Driver=oracle.jdbc.driver.OracleDriver
    URL=jdbc:oracle:thin:@lcsol25:1526:ora920
    User=scott
    Password=*****
    SQL Test=SELECT 1 FROM DUAL

    Result=1

    Test Successful!

  12. In Messaging (JMS) Options, click Next to skip.
  13. In Targeting Options, select Yes and click Next.
  14. In Service Targeting, check the boxes beside oraclePool and MyDataSource to target them to smarticketServer, and click Next.
  15. In Configure Administrative Username and Password, enter any user name and password for smarticketServer.
  16. In Configure Windows Options, accept the default value for Start Menu and for Install Administrative Server as a Windows Service, and click Next.
  17. In Build Start Menu Entries, click Next to skip.
  18. In Configure Server Start Mode and Java SDK, accept the Development Mode and specify either JDK 1.4.1_03 or JRockit 1.4.1_03, and click Next.
  19. In Create WebLogic Configuration, make sure smarticketServer is selected, give your domain the name smarticketDomain, and click Create.

Step 3: Set Up Your Development Environment

  1. Set up your development environment. In a command window, change to the WL_HOME/user_projects/domains/smarticketDomain directory and enter setEnv.cmd (or . setEnv.sh).
  1. Set your environment to include the J2MEWTK_HOME variable, which specifies the home of your Wireless Toolkit. The default directory into which the toolkit is installed is C:\WTK20. In the command window in which you set the environment, enter:

    set J2MEWTK_HOME=c:\WTK20

Step 4: Build and Deploy Smart Ticket

  1. Build Smart Ticket. In the same command window in which you set the environment variables, change to the C:\smarticket\smart_ticket2.0ea\src directory and run the ant build script by typing:

    build


    This ant target builds Smart Ticket to SMARTICKET_HOME\smart_ticket2.0ea\src\app\server\build\smart_ticket.ear.
  2. Start WebLogic Server. In a command window, change to the WL_HOME\user_projects\domains\smarticketDomain directory, and enter:

    startWebLogic.cmd (or . startWebLogic.sh)

  3. Use the Administration Console to deploy the Smart Ticket application on WebLogic Server. In the left panel, expand Deployments->Applications.

    Then in the right panel select the 'Deploy a new application' link. Browse to the build directory, SMARTICKET_HOME\smart_ticket2.0ea\src\app\server\build, select smart_ticket.ear, and click Continue.

    If you have run the client Smart Ticket Application before and are redeploying the application on WebLogic Server, you will have to clear the database of the previous users' information. To do so, run the J2ME Wireless Ticket Utility from Start->Programs->J2ME Wireless Toolkit 2.0->Utilities. Click 'Clean Database' and then restart the Smart Ticket client.
  4. Populate the database. In a Web browser navigate to http://localhost:7001/smartticket and click the link "populate the database," and the database will automatically be populated.
  5. Open the Smart Ticket application. Double-click the smarticket.jad file in the C:\smarticket\smart_ticket2.0ea\src\app\client\midp2\build directory. The wireless device emulator interface for the Smart Ticket client appears.

Step 5: Use Smart Ticket

Use the emulator interface to create an account, entering 95130 or 95054 for your zip code.

Your password must be six characters long.

For instructions on running the SmartTicket demo, refer to the documentation provided in the SMARTICKET_HOME/doc directory.

There are several options available for using the wireless device emulator. To select an alternate device emulator or configure the settings of an emulator, go into the J2ME Wireless Toolkit (Start->Programs->J2ME Wireless Toolkit 2.0) and manipulate the Default Device Selection and the Preferences.