Components Application

  Samples Index



Components Application


This document describes how to utilize the Components JavaServer Faces sample application in conjunction with the Application Server.

This sample application document contains the following sections:



Overview

The following instructions describe how to assemble, deploy to the Application Server, and how to access the Components sample application.



Compiling and Assembling the Application



This Command Line Based Compilation and Assembly procedure describes how to assemble and compile the sample using a Command Line Interface (CLI).


Command Line Based Compilation and Assembly


To rebuild the entire application from scratch:


  1. Compile and Assemble.

    Execute the asant command under <install_dir>/samples/jsf/apps/components/

    [please add <install_dir>/bin to your path]

    The default target core is executed to rebuild the .war file.


  2. Deploy the application.

    When you have re-created the sample application from scratch, proceed to Deploying the application.


  3. Clean the web application project area.

    Execute the asant clean command to remove the sample application's assemble and build directories.

    Now you are ready to use this .war file for deployment.


Deploying the Sample Application

Select one of the following approaches to deploy the application:


Command Line Based Deployment

Since a complete .war file is supplied, the fastest means of setting up the application is to use the command line utilities as described in this section.

If you want to deploy through a GUI tool, follow the instructions for GUI Based Deployment.

The pre-built jsf-components.war is a Web Archive (WAR) file that contains the files of the application.

Since this application consists of EJB and client, it has two JARs - one for each. Individual JAR files have the XML deployment descriptor files, application class files, and other content as required by the application.

Deploy using either the asant script or the asadmin command.


Using the asant Script


  1. Go to the components directory of the sample:

    <install_dir>/samples/jsf/apps/components


  2. Execute the asant deploy command.

Using the asadmin Command


  1. Go to the root of the sample directory:

    <install_dir>/samples/jsf/apps/components/


  2. Execute the asadmin command to deploy the application to the local application server instance:

    asadmin deploy --user <user-name> --password <password> --host <hostname> --port <admin server port> jsf-components.war

The deployment process involves the following operations:


GUI Based Deployment

Since a pre-built Web Archive (.war) file for the sample application is included with the application server, you can use the Admin GUI to quickly read in the .war file and deploy it to the application server.

  1. Start the admin server if it is not already started. Here are the commands for each platform:
    1. Unix - Execute the <install_dir>/bin/asadmin start-domain domain1 command.
    2. Windows - Click "Start->Programs->Sun Microsystems->J2EE 1.4 SDK->Start Default Server"  command.
  2. Open the .war file.
    1. Start Admin GUI, by entering URL  http://localhost:<admin.port>/asadmin   in browser. See replacing "localhost" and <admin.port> note here to determine correct values to use for your environment
    2. You are prompted to supply the user name and password of the application server. Enter correct values for your installed application server for "User Name:"  and "Password:" input fields, then click on the "Login" button.
    3. In the left-hand frame, click Applications-->Web Applications  icon in the tree.
    4. In the right-hand frame, click on the "Deploy..."  button.
    5. Choose the file to be deployed by clicking on the "Browse..."  button, and navigate to select component to deploy (jsf-components.war).
    6. In the browse dialog, click on the "OK"  button.
    7. In the right-hand frame, click on the "Next"  button.
    8. In the right-hand frame, click on the "OK"  button. (Optionally fill in remaining values for application to be deployed)
    9. In the left hand pane, you will see the newly deployed module's icon in the tree. In the right hand pane you will also see the component listed as deployed.

Verifying Deployment

As an optional step, you can use the Application Server Administration Tool to verify that the application has been registered. Otherwise, proceed directly to Running the Sample Application.

To verify the registration of the application, follow these steps:


  1. Execute the command asadmin list-components to look at applications deployed with a server instance. For example:

    asadmin list-components --user <user-name> --password <password> 

    You will see jsf-guessNumber listed.


  2. Alternately, you may navigate the Admin tool GUI to the following:

    Applications-->Web Applications.


  3. On the left frame, Click on Web Applications to display list of web applications deployed on server.

    You will see jsf-guessNumber listed.



Running the Sample Application

Open a browser and enter the following URL (replacing localhost and port 8080 with appropriate values specific to your environment):

  • http://localhost:8080/jsf-components




Generating Javadocs

To understand sample application source code better, you can refer to the related javadocs. To generate javadocs, run the command

asant javadocs

or

asant all

After javadocs are generated, you can access them at

<install_dir>/samples/jsf/apps/components/javadocs/index.html



Troubleshooting



If you encounter problems when running the application, review the log files at <install-dir>/domains/<domain_name>/logs/server.log to see what went wrong.

Make certain that you run asant undeploy before redeploying this sample to make sure that all modules are undeployed.



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

Last Updated March 6, 2004