JNDI Utility Application
This topic provides the following sections:
How the JNDI Utility Application Works
This application is a utility program that creates a list of all the EJBs deployed on a WebLogic Enterprise server process. This application searches the JNDI tree, and checks each entry to see if it is an EJB; if so, this application displays the following information:
- The JNDI name of the EJB's home interface
- The class name of the service stub that the client application is accessing
From the name of the service stub, you can determine the package name of the EJB.
Building and Running the JNDI Utility Application
To build and run the JNDI utility application, complete the following steps:
- Make sure that you have successfully built at least one EJB application; for
example, one of the EJB samples documented in this guide.
- Set your CLASSPATH to include the EJB JAR files for the EJB applications you
have built.
- Copy the files for the JNDI utility application into a work directory.
- Change the protection attribute on the files for the JNDI utility application
- Compile the source file for the JNDI utility application.
- Run the JNDI utility application and examine the output.
The sections that follow provide details on steps 3 through 6.
Copying the Files for the JNDI Utility Application into a Work Directory
You need to copy the file for the JNDI utility application into a work directory on your local machine. The following steps describe how to copy all the file into a work directory.
- If you are using a Unix system, enter the ksh command to use the Korn shell:
prompt>ksh ksh prompt>
- Create a work directory on your machine under the directory described in step 2
in the section Before you Build and Run the EJB Sample Applications.
- Copy the contents of the following directory into the work directory:
Windows NT:
%TUXDIR%\samples\j2ee\ejb\utils
UNIX:
$TUXDIR/samples/j2ee/ejb/utils
The files copied into the work directory are:
- The ListAll.java source file
- The file index.html, which includes the instructions appearing in this topic
Changing the Protection Attribute on the Files for the JNDI Utility Application
During the installation of the WLE software, the sample application files are marked read-only. Before you can edit or build the file in the JNDI utility application, you need to change the protection attribute of the file you copied into your work directory, as follows:
Windows NT:
prompt>attrib /S -r drive:\workdirectory\*.*
UNIX:
prompt>ksh
ksh prompt>chmod +w /workdirectory/*.*
Compiling the Source File for the JNDI Utility Application
Compile the source file for the JNDI utility application. For example, on Windows NT, enter the following command:
prompt> javac ListAll.java
Running the JNDI Utility Application and Examining the Output
To run the JNDI utility application, complete the following steps:
- Change to the EJB application's work directory, if necessary.
- Boot the EJB application and run the client by entering the following commands:
Windows NT:
prompt>tmboot -y prompt>run_client.cmd
UNIX:
prompt>tmboot -y prompt>./run_client.ksh
- Change to the JNDI application's work directory.
- Run the JNDI utility program, as in the following command:
prompt> java ListAll corbaloc://host:port
In the preceding command, host:port represent the TCP/IP address of the IIOP listener/handler for the WLE domain.
- Examine the output displayed by the JNDI utility application, which may appear
similar to the following:
Starting to search tree for all EJBeans...
EJBean Binding Name: statelessSession.TraderHome Classname: samples.j2ee.ejb.basic.statelessSession.TraderBeanHomeImpl_WLStub
Finished searching tree for all EJBeans...
|