Sun Java System Application Server 

Samples Index

The JNDI URL Sample Application

This sample application demonstrates using a JNDI resource to connect to a URL. The application uses an enterprise bean to display the contents of a web page by connecting to its URL. The jndi-name element of the enterprise bean in sun-ejb-jar.xml specifies a target URL. The enterprise bean is invoked by a client class.

Additional Configuration Steps

Note these additional configuration steps.

Building, Deploying, and Running the Application

The general instructions for building, deploying, and running sample applications are provided in Building, Deploying, and Running Sample Applications. In reading this document, use the following application-specific variables for this application:

Follow this general procedure:

  1. Build the Application. The build file, build.xml, is in the app_dir directory, specifically, install_dir/samples/jndi/apps/url.
  2. Deploy the Application. The EAR file is install_dir/samples/jndi/apps/url/jndi-url.ear.
  3. Run the Application as described below.

Running the Sample Application

To run the application, enter these commands:

cd  install_dir/samples/jndi/apps/url
asant run

This command will display the contents of the file install_dir/samples/index.html.

Troubleshooting

The URL specified in sun-ejb-jar.xml assumes that the HTTP server port of the application server installation is 8080. If the port is other than 8080, modify sun-ejb-jar.xml before compiling and deploying the sample application.

Run asant undeploy before redeploying this sample. This will ensure that all modules are undeployed and that the resources are disabled.

For more information on troubleshooting, see Troubleshooting.


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