Sun ONE logo     
Simple Web Sample Application



Simple Web Sample Application


This document describes how to utilize the Simple Web sample application in conjunction with Sun ONE Application Server version 7.

This sample application document contains the following sections:



Overview

The Simple Web sample application is a collection of simple servlets and JSPs that demonstrate the usage of the Servlet and the JSP specification.

Assembling this application and deploying it to the Sun ONE Application Server introduces you to the Sun ONE Application Server Admin Tool.

The following instructions describe how to manually deploy the application. You may want to experiment by modifying and redeploying the sample.

To better understand the sample application source code, you may refer to the related javadocs which can be accessed at <install_root>/samples/webapps/simple/javadocs/index.html after it is generated.

Setting up the environment

In order to successfully deploy and run the Simple Web sample application, several resources need to be setup with the Application Server. These resources include Javamail and JNDI resources.

The build scripts provided will automatically register all the above resources with Application Server.



Compiling and Assembling the Application



This section contains instructions to build and assemble the Simple Web sample application using a Command Line Interface (CLI).

To rebuild the entire application from scratch, follow these steps:

  1. Compile and assemble the application. For ezample:

    Execute the command asant under <install_root>/samples/webapps/simple/src/

    The default target core will be executed to rebuild the WAR files.

  2. Deploy the application.

    After you have re-created the sample application from scratch, you may proceed to Deploying the Sample Application. Step 3 is optional.

  3. Clean the application project area (optional).

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

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



Deploying the Sample Application

To deploy the application, do the following:

Execute the command asant deploy under <install_root>/samples/webapps/simple/src

This will deploy the webapps-simple.war file located under <install_root>/samples/webapps/simple/


Note You must run asant undeploy before redeploying this sample. This will ensure that all modules are undeployed and the resources are disabled.




Verifying Deployment

As an optional step, you can use the Sun ONE 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, do the following:

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

    asadmin list-components --user <username> --password <password> --host <host> --port <admin-port> <server instance name>

    You will see webapp-simple listed.

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

    App Server Instances>server1>Applications.

  3. On the left frame, Click on Web Apps to diplay list of applications deployed on server.

    You will see webapp-simple listed.



Running the Sample Application

You can run the application through the following URL:

http://<hostname>:<port>/webapps-simple

Traverse the JSP and Servlet links to execute each simple web sample application.



Troubleshooting



If you encounter problems when running the application, review the log files at <install_root>/domains/domain1/<server-instance>/logs/server.log to learn what exactly went wrong.



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

Last Updated July 12, 2002