JNDI URL Sample Application

> JNDI URL Sample Application
> This document describes how to use the JNDI URL sample application in conjunction with Sun ONE Web Server.

> This sample application document contains the following sections:

> Overview

> - Compiling and Assembling the Application

> - Deploying the Sample Application

> - Running the Sample Application

> Overview
> The JNDI URL sample application demonstrates using the JNDI resource to connect to a URL. The application uses a a servlet for displaying the contents of a web page by connecting to its URL. The jndi-name element in sun-web.xml specifies a target URL. The following URL is hardcoded in the sun-web.xml file; make sure that URL is working fine: http://localhost/launch.html. You can use any valid URL.

> Compiling and Assembling the Application

> To compile and assemble the sample application:

> 1. Go to <install_root>/plugins/java/samples/webapps/jndi/url/src and execute the ant command.
>    The default target 'default' will be executed to build the WAR file.
> 2. Deploy the application.
>    After you have created the sample application from scratch, you can proceed to Deploying the Sample Application. Step 3 is optional.
> 3. To clean the web application project area (optional), execute the following command:
>    ant clean
> Deploying the Sample Application

> To deploy the sample application:
> 1. Go to the src directory of the sample:
>    <install_root>/plugins/java/samples/webapps/jndi/url/src
> 2. Run ant using the deploy task:
>    ant deploy
> If you want to verify registration of the application, proceed to Verifying Deployment. Otherwise, proceed to Running the Sample Application.

> Verifying Deployment

> - Go to <install_root>/plugins/java/samples/webapps/jndi/url/src
> - Execute the following command:

> > ant list_apps
> > You will see the jndi-url module displayed as one of the listed components.

> Undeploying the Application

> > 1. Go to <install_root>/plugins/java/samples/webapps/jndi/url/src
> > 2. Execute the following command:
> >    ant undeploy

> Running the Sample Application

> > You can run the application through the following URL:

> > http://<Web_Server_hostname>:<port>/jndi-url/jndiurlexample

> Copyright © 2003 Sun Microsystems, Inc. All rights reserved.