![]() |
![]() |
|
|
Child Bean Sample Application
This topic includes the following sections:
How the Child Bean Sample Works
The parent bean sample and the child bean sample together show subclassing an EJB. Each sample shows a stateless session bean. The child bean overrides some methods from the parent bean, and also invokes methods directly on the parent bean. Thus, the child bean sample shows subclassing and one bean invoking another bean.
The parent bean sample application implements the following classes:
Class |
Description |
---|---|
Client |
This class is used with the ParentBean EJB to illustrate using an EJB that subclasses from a another bean. |
ChildBean |
ChildBean is a stateless session bean. |
Building and Running the Child Bean Sample
To build and run the child bean sample application, complete the following steps:
The following sections describe these steps, and also explain the following:
Verifying the Settings of the Environment Variables
Before building and running the child bean sample application, you need to ensure that certain environment variables are set on your system. In most cases, these environment variables are set as part of the installation procedure. However, you need to check the environment variables to ensure they reflect correct information.
Table 7-1 lists the environment variables required to run the child bean sample application.
Table 7-1 Environment Variables
Environment Variable |
Description |
---|---|
TUXDIR |
The directory path where you installed the WebLogic Enterprise software. For example: Windows NT TUXDIR=c:\wledir UNIX TUXDIR=/usr/local/wledir |
JAVA_HOME |
The directory path where you installed the JDK software. For example: Windows NT JAVA_HOME =c:\JDK1.2 UNIX JAVA_HOME =/usr/local/JDK1.2 |
You may optionally set the following system environment variables to change their default value prior to running the child bean sample application runme command. See the Administration Guide for more information about selecting appropriate values for these environment variables.
Table 7-2 lists the optional environment variables required to run the child bean sample application.
Table 7-2 Optional Environment Variables
Environment Variable |
Description |
---|---|
HOST |
The host name portion of the TCP/IP network address used by the ISL process to accept connections from Java clients. The default value is the name of the local machine. |
PORT |
The TCP port number at which the ISL process listens for incoming requests; it must be a number between 0 and 65535. The default value is 2468. |
IPCKEY |
The address of shared memory; it must be a number greater than 32769 unique to this application on this system. The default value is 55432. |
Verifying the Environment Variables
To verify that the information for the environment variables defined during installation is correct, complete the following steps:
Windows NT
The Control Panel appears.
The System Properties window appears.
The Environment page appears.
UNIX
ksh prompt>printenv TUXDIR
ksh prompt>printenv JAVA_HOME
Changing the Environment Variables
To change the environment variable settings, complete the following steps:
Windows NT
The Control Panel appears.
The System Properties window appears.
The Environment page appears.
UNIX
ksh prompt>export TUXDIR=directorypath
ksh prompt>export JAVA_HOME=directorypath
Copying the Files for the Child Bean Sample Application into a Work Directory
You need to copy the files for the child bean sample application into a work directory on your local machine. The following steps describe how to copy all the example files into a work directory.
prompt>ksh
ksh prompt>
Windows NT
%TUXDIR%\samples\j2ee\ejb\subclass\child
UNIX
$TUXDIR/samples/j2ee/ejb/subclass/child
The files copied into the work directory are in two categories:
Table 7-3 lists and describes all the files for this sample application:
Table 7-3 Sample Application Files
File |
Description |
---|---|
ejb-jar.xml |
The XML deployment descriptor file used to help add the bean to the EJB container. |
weblogic-ejb-extensions.xml |
A file containing the WebLogic Enterprise extensions to the deployment descriptor DTD. |
Client.Java |
The Java source code for the client application. |
ChildBean.java |
The Java source code for the stateless session bean. This class contains the business logic method implementations and methods required by the EJB specification 1.1. |
Child.java |
The Java source code for the remote interface of the ChildBean class. |
ChildHome.java |
The Java source code for the home interface of the the ChildBean class. |
index.html |
File containing these instructions. |
Table 7-4 lists and describes the utility files for this sample application. These files are generated based on the WebLogic Enterprise installation environment. The following files are generated in the same directory as where the source files are found.
Table 7-4 Utility Files
File |
Description |
---|---|
runme.cmd |
The Windows NT batch file that contains commands to set the environment, boot the server, and execute the client for this sample |
runme.ksh |
The UNIX Korn shell script that contains commands to boot the server and execute the client for this sample. |
run_client.cmd |
The batch file to run the client application on Windows NT systems. |
run_client.ksh |
The script file to run the client on UNIX systems. |
setenv.cmd |
The batch file to set the necessary environment variables on Windows NT systems. |
setenv.ksh |
The script file to set the necessary environment variables on UNIX systems. |
ubbconfig |
The WebLogic Enterprise server configuration file to be used on UNIX systems. |
ubbconfig.nt |
The WebLogic Enterprise server configuration file to be used on Windows NT systems. |
ejb_subclass_child.jar |
The EJB JAR file that contains the source file classes, the container-specific class files generated by the ejbc command, and the deployment descriptor files. This is the EJB JAR file that is deployed on the WebLogic Enterprise server. |
Changing the Protection Attribute on the Files for the Child Bean Sample Application
During the installation of the WebLogic Enterprise software, the sample application files are marked read-only. Before you can edit or build the files in the child bean sample application, you need to change the protection attribute of the files you copied into your work directory, as follows:
Windows NT
prompt>attrib /S -r drive:\workdirectory\*.*
UNIX
prompt>ksh
ksh prompt>chmod +w /workdirectory/*.*
On the UNIX operating system platform, you also need to change the permission of runme.ksh and clean.ksh to give execute permission to those files, as follows:
ksh prompt>chmod +x *.ksh
Executing the runme Command
The runme command automates the following steps:
To build and run the stateless session bean sample application, make sure you have copied the scripts described in Before you Build and Run the EJB Sample Applications, and enter the runme command, as follows:
Windows NT
prompt>cd workdirectory
prompt>runme subclass child
UNIX
ksh prompt>cd workdirectory
ksh prompt>./runme.ksh subclass child
A number of messages are displayed, along with whether or not the build procedure was successful. Note that the sample is not only built, but also the servers are booted and the client is run once.
Running the Sample Manually
After you have executed the runme command, you can run the sample manually if you like. To run the samples manually, complete the following steps:
Windows NT
prompt>setenv
UNIX
prompt>. ./setenv.ksh
Windows NT
prompt>tmboot -y
prompt>run_client.cmd
UNIX
prompt>tmboot -y
prompt>./run_client.ksh
Processes and Files Generated by the Sample Application
When the you enter the tmboot command to start one of the EJB sample applications, the following server processes are started:
The BEA Tuxedo system Event Broker.
The following TMFFNAME processes are started:
The JavaServer takes one or more EJB JAR files that were created for the application.
The IIOP Listener/Handler.
Stopping the Sample Application
You can stop the child bean sample application by entering the following command:
prompt>tmshutdown -y
Child Bean Javadoc
The Javadoc for the child bean example is in the following location:
Windows NT
%TUXDIR%/samples/j2ee/ejb/subclass/child/index.html
UNIX
$TUXDIR\samples\j2ee\ejb\subclass\child\index.html
If you are viewing this document in a browser, you can click the following link to display this Javadoc:
Package samples.j2ee.ejb.subclass.child
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|