|
|
This topic includes the following sections:
For troubleshooting information and the most recent information about using the XA Bankapp sample application, see the Readme.txt
file in the \WLEdir\samples\corba\bankapp_java\XA
directory.
The XA Bankapp sample application is a CORBA application that implements the same automatic teller machine (ATM) interface as the JDBC Bankapp sample application. However, the XA Bankapp sample application uses the Oracle XA library and the WebLogic Enterprise (WLE) Transaction Manager to coordinate transactions between the WLE application and the Oracle database that stores account and customer information.
This topic includes the following sections:
How the XA Bankapp Sample Application Works
The XA Bankapp sample application consists of two server applications:
Server Applications
Figure 4-1 illustrates how the XA Bankapp sample application works.
In the XA Bankapp sample application, transactions are started and stopped in the Teller
object using the Java Transaction Service (JTS) API. In the JDBC Bankapp sample application, transactions are started and stopped in the DBAccess
object using the Java Database Connectivity (JDBC) API.
In the XA Bankapp sample application, the DBAccess
object is implemented in C++ instead of Java and resides in its own server application. The object reference for the DBAccess
object is generated in its Server::initialize
method and is registered with the FactoryFinder
environmental object.
To run the XA Bankapp sample application, you need to install the following software:
Application Workflow
Figure 4-1 The XA Bankapp Sample Application
Software Prerequisites
This topic includes the following sections:
Development Process for the XA Bankapp Sample Application
These sections describe the development process for the XA Bankapp sample application.
Note:
The steps in this section have been done for you and are included in the XA Bankapp sample application.
The BankApp.idl
file used in the XA Bankapp sample application defines the TellerFactory
and Teller
interfaces and the Bank.idl
file defines exceptions and structures. The transfer_funds
interface has been removed from the BankDB.idl
because transactions are now started and stopped by the Teller
object.
The XA Bankapp sample application uses the same client application as the JDBC Bankapp sample application.
For the XA Bankapp sample application, you would write the following:
Object Management Group (OMG) Interface Definition Language (IDL)
Client Application
Server Application
During development, you create a Server Description File (BankApp.xml
) that defines the activation and transaction policies for the TellerFactory
and Teller
objects. Table 4-1 shows the activation and transaction policies for the XA Bankapp sample application.
Server Description File
Interface |
Activation Policy |
Transaction Policy |
---|---|---|
A Server Description File for the XA Bankapp sample application is provided. For information about creating Server Description Files and defining activation and transaction policies on objects, see Creating Java Server Applications.
When writing WLE C++ server applications, you create an Implementation Configuration File (ICF), which is similar to the Server Description File. This file has been created for you and defines an activation policy of transaction
and a transaction policy of always
for the DBAccess
interface.
For information about creating ICF files and defining activation and transaction policies on objects, see Creating C++ Server Applications.
During development, you need to include the following information in the UBBCONFIG
file:
Implementation Configuration File
UBBCONFIG File
For information about the transaction log and defining parameters in the UBBCONFIG
file, see Using Transactions.
The XA Bankapp sample application uses an Oracle database to store all the bank data. Before using the XA Bankapp sample application, you need to install the following Oracle components:
Setting Up the Database for the XA Bankapp Sample Application
Note: When installing the specified Oracle components, other Oracle components are also installed. However, you will not use these additional components with the XA Bankapp sample application.
You also need to start the Oracle database daemon and enable an XA resource manager.
For information about installing the Oracle database and performing the necessary setup tasks, see the product documentation for the Oracle database.
This topic includes the following sections:
Building the XA Bankapp Sample Application
These sections describe how to build the XA Bankapp sample application.
You need to copy the files for the XA Bankapp sample application into a work directory on your local machine.
The files for the XA Bankapp sample application are located in the following directories:
Windows NT
drive:
\WLEdir\samples\corba\bankapp_java\XA
drive:
\WLEdir\samples\corba\bankapp_java\client
drive:
\WLEdir\samples\corba\bankapp_java\shared
UNIX
/usr/local/WLEdir/samples/corba/bankapp_java/XA
/usr/local/WLEdir/samples/corba/bankapp_java/client
/usr/local/WLEdir/samples/corba/bankapp_java/shared
Table 4-2 describes the contents of these directories:
Step 1: Copy the Files for the XA Bankapp Sample Application into a Work Directory
Source File Directories
You need only to copy the files manually in the XA directory. The other files are automatically copied from the \client and \shared directories when you execute the setupX command. For example:
Windows NT
prompt> cd c:\mysamples\bankapp_xa\XA
prompt> copy c:\WLEdir\samples\corba\bankapp_xa\XA\*
UNIX
ksh prompt> cd /usr/mysamples/bankapp_xa/XA/*
ksh prompt> cp $TUXDIR/samples/bankapp_xa/XA/*
Note: You cannot run the XA Bankapp sample application in the same work directory as the JDBC Bankapp sample application, because some of the files for the JDBC Bankapp sample application have the same name as files for the XA Bankapp sample application.
Table 4-3 lists the files used to build and run the XA Bankapp sample application.
During the installation of the WLE software, the files for the XA Bankapp sample application are marked read-only. Before you can edit or build the files in the XA Bankapp sample application, you need to change the protection attribute of the files you copied into your work directory, as follows:
Windows NT
prompt>attrib -r drive:\
workdirectory
\*.*
UNIX
prompt>/bin/ksh
ksh prompt>chmod u+w /
workdirectory
/*.*
Before building and running the XA Bankapp 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 4-4 lists the environment variables required to run the XA Bankapp sample application.
Step 2: Change the Protection Attribute on the Files for the XA Bankapp Sample Application
Step 3: Verify the Settings of the Environment Variables
Environment Variables
To verify that the information defined during installation is correct:
Windows NT
Verifying Settings
The Control Panel appears.
The System Properties window appears.
The Environment page appears.
UNIX
ksh prompt>printenv TUXDIR
ksh prompt>printenv JAVA_HOME
ksh prompt>printenv ORACLE_HOME
To change the settings:
Windows NT
UNIX
ksh prompt>TUXDIR= directorypath ; export TUXDIR
ksh prompt>JAVA_HOME= directorypath ; export JAVA_HOME
ksh prompt>JAVA_HOME= directorypath ; export ORACLE_HOME
Note: If you are running multiple WLE applications concurrently on the same machine, you also need to set the IPCKEY and PORT environment variables. See the Readme.txt file for information about how to set these environment variables.
The setupX command automates the following steps:
Enter the setupX command, as follows:
Windows NT
prompt> cd c:\mysamples\bankapp_xa\XA
prompt>setupX
UNIX
prompt>/bin/ksh
prompt> cd /usr/mysamples/bankapp_xa/XA/*
prompt>. ./setupX.ksh
Use the following command to load the UBBCONFIG file:
prompt>tmloadcf -y ubb_xa
The transaction log records the transaction activities in a WLE session. During the development process, you need to define the location of the transaction log (specified by the TLOGDEVICE parameter) in the UBBCONFIG file. For the XA Bankapp sample application, the transaction log is placed in your work directory.
To open the transaction log for the XA Bankapp sample application:
tmadmin
crdl -b
blocks
-z
directorypath
TLOG
crlog -m SITE1
where
blocks specifies the number of blocks to be allocated for the transaction log and directorypath indicates the location of the transaction log. The directorypath option needs to match the location specified in the TLOGDEVICE parameter in the UBBCONFIG file. The following is an example of the command on Windows NT:
crdl -b 500 -z c:\mysamples\bankapp_java\XA\TLOG
The directory for the XA Bankapp sample application contains a make file that builds the client and server applications. During the development process, you use the buildjavaserver command to build the server application, and your Java product's development commands to build the client application. However, for the XA Bankapp sample application, this step is included in the make file.
Use the following commands to build the client and server applications in the XA Bankapp sample application:
Windows NT
prompt>nmake -f makefileX.nt
UNIX
prompt>make -f makefileX.mk
Use the following command to initialize the Oracle database used with the XA Bankapp sample application:
Windows NT
prompt>nmake -f makefileX.nt InitDB
UNIX
ksh prompt>make -f makefileX.mk InitDB
Start the server application in the XA Bankapp sample application by entering the following command:
prompt>tmboot -y
The tmboot command starts the application processes listed in Table 4-5.
Table 4-6 lists the files generated by the XA Bankapp sample application.
Start the ATM client application by entering the following command:
Note:
The following command sets the Java CLASSPATH to include the current directory and the client JAR file (m3envobj.jar
). The full WLE JAR file (m3.jar
) can be specified instead of the client JAR file.
Windows NT
prompt>java -classpath .;%TUXDIR%\udataobj\java\jdk\m3envobj.jar -DTOBJADDR=%TOBJADDR% Atm Teller2
UNIX
ksh prompt>java -classpath .:$TUXDIR/udataobj/java/jdk The GUI for the ATM client application appears.
Before using another sample application, enter the following commands to stop the XA Bankapp sample application and to remove unnecessary files from the work directory:
Windows NT
prompt>tmshutdown -y
prompt>nmake -f makefileX.nt clean
UNIX
ksh prompt>tmshutdown -y
ksh prompt>make -f makefileX.mk clean
The ATM client application in the XA Bankapp sample application works as it does in the JDBC Bankapp sample application. For instructions, see Using the ATM Client Application.
Starting the ATM Client Application in the XA Bankapp Sample Application
/m3envobj.jar -DTOBJADDR=$TOBJADDR Atm Teller2
Stopping the XA Bankapp Sample Application
Using the ATM Client Application
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|