Java TM Custom JNDI Resource Factory Sample Application |
Custom JNDI Resource Factory Sample Application
This document describes how to create, install, configure, and use your own custom JNDI resource factory in 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
Overview
The Custom JNDI Resource Factory Sample Application demonstrates:
- How to create and deploy an application that utilizes a Custom JNDI Resource Factory
- How to use JNDI custom factories in a J2EE 1.4 platform compliant application component
The JNDI custom factory described here can only create samples.jndi.custom.share.CustomBean beans.
Along with the custom JNDI factory, the sample application provides an application client component that illustrates how to use such a custom factory to obtain a CustomBean.
The Custom JNDI Resource Factory sample application contains an application client that illustrates how to use the Custom JNDI Resource Factory.
The directory structure of the Sample Application is as follows (all paths are relative to <install_dir>/samples/jndi/apps/custom/):
custom-client/src/conf - contains the application client deployment descriptors required for deployment on the Application Servercustom-client/src/java/samples/jndi/custom/client - source code for the application clientcustom-share/src/java/samples/jndi/custom/share - source code for the custom bean (CustomBean) object and the class implementing the Custom JNDI Resource Factory (MyJndiCustomFactory).
Compiling and Assembling the Application
This section contains instructions on how to build and assemble the application.
- Compile and assemble the application.
- Change directory to: <install_dir>/samples/jndi/apps/custom.
- Execute the command asant core. This command compiles all source files and assembles the following module:
- jndi-custom.ear
Main application, containing an application client that illustrates how to use the Custom JNDI Resource Factory- Deploy the application.
After compiling the sources and assembling the EAR file, 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/apps/custom. The API documentation will be located under <install_dir>/samples/jndi/apps/custom/javadocs.
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/custom.
This command deploys the EAR file of the Custom JNDI Resource Factory sample application, jndi-custom.ear.
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>You will see the sample Custom JNDI Resource Factory listed as a J2EE application:
custom <j2ee-application>
Running the Sample Application
Execute the command asant run under <install_dir>/samples/jndi/apps/custom.
This command invokes the application client of the Custom JNDI Resource Factory sample application. The application client looks up the JNDI name of the resource associated with the custom JNDI resource factory (this resource was created during deployment). It then displays the values of the bean properties.
Troubleshooting
If you encounter problems when running the application, review the Application Server log file located at
<install_dir>/domains/<domain-name>/logs/server.logto learn what exactly went wrong.
Copyright © 2004 Sun Microsystems, Inc. All rights reserved.Last Updated August 2, 2004