![]() |
![]() |
BEA WebLogic Enterprise 4.2 Developer Center |
![]() HOME | SITE MAP | SEARCH | CONTACT | GLOSSARY | PDF FILES | WHAT'S NEW |
||
![]() GETTING STARTED | TABLE OF CONTENTS | PREVIOUS TOPIC | INDEX |
This chapter discusses the following topics:
Refer to the The XA Bankapp sample application 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. The XA Bankapp sample application consists of two server applications:
Readme.txt
file in the \WLEdir\samples\corba\bankapp_java
directory for troubleshooting information and for the most recent information about using the XA Bankapp sample application.
How the XA Bankapp Sample Application Works
TellerFactory
and Teller
objects
DBAccesss
interface
Figure 4-1 illustrates how the XA Bankapp sample application works.
In the XA Bankapp sample application, transactions are started and stopped in the In the XA Bankapp sample application, the To run the XA Bankapp sample application, you need to install the following software:
Figure 4-1 The XA Bankapp Sample Application
Teller
object using the Java Transaction Service (JTS) protocol. In JDBC Bankapp, transactions are started and stopped in the DBAccess object using the Java Database Connectivity (JDBC) protocol.
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.
Software Prerequisites
This section describes 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 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:
The Development Process for the XA Bankapp Sample Application
Object Management Group (OMG) Interface Definition Language (IDL)
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 Client Application
The Server Application
For information about writing server applications, see Creating Java Server Applications and Creating C++ Server Applications.
During development, you create a Server Description File ( Process
Never
Method
Never
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 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 The Server Description File
BankApp.xml
) that defines the activation and transaction policies for the TellerFactory
and Teller
objects. For the XA Bankapp sample application, the objects have the following activation and transaction policies:
Interface
Activation Policy
Transaction Policy
TellerFactory
Teller
The Implementation Configuration File
transaction
and a transaction policy of always
for the DBAccess
interface.
The UBBCONFIG File
UBBCONFIG
file:
OPENINFO
parameter, defined according to the XA
parameter for the Oracle database. The XA
parameter for the Oracle database is described in the "Developing and Installing Applications that Use the XA Libraries" section of the Oracle7 Server Distributed Systems manual.
TLOG
) in the TLOGDEVICE
parameter.
For information about the transaction log and defining parameters in the 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:
UBBCONFIG
file, see the Administration Guide.
Setting Up the Database for 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.
To build the XA Bankapp sample application:
Building the XA Bankapp Sample Application
The following sections describe these steps.
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
The directories contain the following:
XA
-contains the source files and commands needed to build and run the XA Bankapp sample application.
shared
-contains common files for the JDBC Bankapp and XA Bankapp sample applications.
You only need to manually copy the files in the XA directory. The other files are automatically copied from the Windows NT
UNIX
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.
You will use the files listed in Table 4-1 to build and run the XA Bankapp sample application.
During the installation of theWLE 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
UNIX
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-2 lists the environment variables required to run the XA Bankapp sample application.
To verify that the information defined during installation is correct:
Windows NT
\client
and \shared
directories when you execute the setupX
command. For example:
prompt> cd c:\mysamples\bankapp_xa\XA
prompt> copy c:\WLEdir\samples\corba\bankapp_xa\XA\*
ksh prompt> cd /usr/mysamples/bankapp_xa/XA/*
ksh prompt> cp $TUXDIR/samples/bankapp_xa/XA/*
Changing the Protection Attribute on the Files for the XA Bankapp Sample Application
prompt>attrib -r drive:\
workdirectory
\*.*
prompt>/bin/ksh
ksh prompt>chmod u+w /
workdirectory
/*.*
Verifying the Settings of the Environment Variables
The Control Panel appears.
The System Properties window appears.
The Environment page appears.
TUXDIR,
ORACLE_HOME,
and JAVA_HOME
.
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:
\client
and \shared
directories
PATH
, TOBJADDR
, APPDIR
, TUXCONFIG
, and CLASSPATH
system
environment variables
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
where
crdl -b
blocks
-z
directorypath
TLOG
crlog -m SITE1blocks
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
quit t
o exit the Interactive Administrative Interface.
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 following application processes:
TMSYSEVT
The BEA TUXEDO system event broker.
TMFFNAME
Three TMFFNAME
server processes are started:
TMFFNAME
server process with the -N
and -M
options is the master NameManager service. The NameManager service maintains a mapping of the application-supplied names to object references.
TMFFNAME
server process started with the -N
option only is the slave NameManager service.
TMFFNAME
server process started with the -F
option contains the FactoryFinder object.
TMS_ORA
The transaction manager service.
BankDataBase
The WLE server process that implements the DBAccess
interface.
JavaServerXA
BankApp.jar
, which is the Java Archive (JAR) file that was created by the buildjavaserver
command.
TellerFactory_1
, which is passed to the Server.initialize()
method.
ISL
Table 4-3 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 ( Windows NT
UNIX
The GUI for the ATM client application appears. Figure 3-2 shows the GUI for the ATM client application.
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
UNIX
The ATM client application in the XA Bankapp sample application works as it does in the JDBC Bankapp sample application.
Files Generated by the XA Bankapp Sample Application
Starting the ATM Client Application in the XA Bankapp Sample Application
m3envobj.jar
). The full WLE JAR file (m3.jar
) can be specified instead of the client JAR file.
prompt>java -classpath .;%TUXDIR%\udataobj\java\jdk\m3envobj.jar -DTOBJADDR=%TOBJADDR% Atm Teller2
ksh prompt>java -classpath .:$TUXDIR/udataobj/java/jdk
/m3envobj.jar -DTOBJADDR=$TOBJADDR Atm Teller2Stopping the XA Bankapp Sample Application
prompt>tmshutdown -y
prompt>nmake -f makefileX.nt clean
ksh prompt>tmshutdown -y
ksh prompt>make -f makefileX.mk clean
Using the ATM Client Application