The Java EE 6 Tutorial

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

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

  2. In NetBeans IDE, select File->Open Project.

  3. In the Open Project dialog, navigate to:


    tut-install/examples/security/
    
  4. Select the cart-secure folder.

  5. Select the Open as Main Project and Open Required Projects check boxes.

  6. Click Open Project.

  7. In the Projects tab, right-click the cart-secure project and select Build.

  8. In the Projects tab, right-click the cart-secure project and select Deploy.

    This step builds and packages the application into cart-secure.ear, located in the directory tut-install/examples/security/cart-secure/dist/, and deploys this EAR file to your GlassFish Server instance.

  9. To run the application client, right-click the cart-secure project and select Run.

    A Login for user: dialog box appears.

  10. 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 you enter are authenticated, the output of the application client appears in the Output pane:


    ...
    Retrieving book title from cart: Infinite Jest
    Retrieving book title from cart: Bel Canto
    Retrieving book title from cart: Kafka on the Shore
    Removing "Gravity's Rainbow" from cart.
    Caught a BookException: "Gravity's Rainbow" not in cart.
    Java Result: 1
    ...

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