JNDI URL Sample Application

  Samples Index



JNDI URL Sample Application


This document describes how to utilize the JNDI URL sample application in conjunction with the Sun Java System Application Server 8.1 2005Q1.

This document contains the following sections:



Overview

Note The URL specified under 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.


The JNDI URL sample application demonstrates how to use 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.



Compiling and Assembling the Application



This section contains instructions on how to build and assemble the JNDI URL sample application.
  1. Compile and assemble the application.
    1. Change directory to: <install_dir>/samples/jndi/apps/url.
    2. Execute the command asant core. This command compiles all sources and assembles the JAR and EAR files.
  2. Deploy the application.
  3. After compiling the sources and assembling the application, you may proceed to Deploying the Sample Application. Steps 3 and 4 are optional.
  4. Clean the application project area (optional).
  5. Execute the command asant clean to remove all the files generated in Step 1.
  6. Generate API documentation (optional).
  7. Execute the command asant javadocs under <install_dir>/samples/jndi/url. The API documentation will be located under <install_dir>/samples/jndi/url/javadocs.

Now you are ready to use the EAR file for deployment.



Deploying the Sample Application

This section contains instructions on how to deploy the application on the Application Server.

Execute the command asant deploy under <install_dir>/samples/jndi/apps/url. This command deploys the EAR file of the JNDI URL sample application: jndi-url.ear.

The pre-built jndi-url.ear file is an Enterprise Archive file that contains the JAR file of the application. Within the JAR file are the XML deployment descriptor files, application class files, and other content required by the application.

The deployment process involves the following operations:


Verifying Deployment

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

To verify the registration of the application, execute the command asadmin list-components to look at applications deployed with a server instance. For example:

<install_dir>/bin/asadmin list-components --user <username> --password <password>


Running the Sample Application

The URL connection factories do not require any resources to be created in domain.xml. The application is run by running the client class, which invokes the enterprise bean.

To run the JNDI URL sample application, execute the command asant run under <install_dir>/samples/jndi/apps/url.

The contents of the index.html file that resides in <install_dir>/samples/ will be displayed.



Troubleshooting




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

Last Updated August 2, 2004