JNDI URL Sample Application |
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
- Compiling and Assembling the Application
- Deploying the Sample Application
- Running the Sample Application
- Troubleshooting
Overview
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.
- Compile and assemble the application.
- Change directory to: <install_dir>/samples/jndi/apps/url.
- Execute the command asant core. This command compiles all sources and assembles the JAR and EAR files.
- Deploy the application.
After compiling the sources and assembling the application, you may proceed to Deploying the Sample Application. Steps 3 and 4 are optional.- Clean the application project area (optional).
Execute the command asant clean to remove all the files generated in Step 1.- Generate API documentation (optional).
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:
- WHAT Authenticates against the local application server's administrative server. NEED A SUBJECT
- The EAR file is transferred to the administrative server.
- The administrative server begins the registration process:
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.
- 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 application.
- Make sure that you run asant undeploy before redeploying this sample. This will ensure that all modules are undeployed and that the resources are disabled.
- Although the ear, context-root, and servlet alias names in this sample are all "jndi-url", this naming convention is not necessary. The application will work as expected if the name of each of these elements is unique. Rebuild the application after changing the context-root name (in application.xml) and the ear name (in build.xml). Redeploy and test the sample to confirm these changes.
- If you encounter problems when running the application, review the Application Server log file located at <install_dir>/domains/<domain_name>/logs/server.log to learn what exactly went wrong.
Copyright © 2004 Sun Microsystems, Inc. All rights reserved.Last Updated August 2, 2004