The Java EE 6 Tutorial

ProcedureTo Build, Package, Deploy, and Run the Secure Cart Example Using Ant

  1. Follow the steps in To Set Up Your System for Running the Security Examples.

  2. In a terminal window, go to:


    tut-install/examples/security/cart-secure/
    
  3. To build the application and package it into an EAR file, type the following command at the terminal window or command prompt:


    ant
    
  4. To deploy the application to the GlassFish Server, type the following command:


    ant deploy
    
  5. To run the application client, type the following command:


    ant run
    

    This task retrieves the application client JAR and runs the application client.

    A Login for user: dialog box appears.

  6. In the dialog box, type the user name and password of a file realm user created on the GlassFish Server and assigned to the group TutorialUser; then click OK.

    If the user name and password are authenticated, the client displays the following output:


    [echo] running application client container.
    [exec] Retrieving book title from cart: Infinite Jest
    [exec] Retrieving book title from cart: Bel Canto
    [exec] Retrieving book title from cart: Kafka on the Shore
    [exec] Removing "Gravity's Rainbow" from cart.
    [exec] Caught a BookException: "Gravity's Rainbow" not in cart.
    [exec] Result: 1

    If the username and password are not authenticated, the dialog box reappears until you type correct values.