Assuming that the JBoss Transactioning product has
been installed, this trail provides a set of
examples that show how to build transactional
applications. Two types of transactional
applications are presented, those using the JTA
interface and those accessing to the JTS (OTS)
interfaces.
Please follow these steps before running the
transactional applications
-
Ensure you have the Ant build system installed.
Ant is a Java build tool, similar to make. It is
available for free from http://ant.apache.org/
The sample application requires version 1.5.1 or
later.
-
The PATH and CLASSPATH environment variables
need to be set appropriately to use JBoss
Transaction Service. To make this easier, we
provide a shell script setup_env.sh (and for
Windows a batch file setup_env.bat) in the
directory
<jbossts_install_root>/bin/
-
From a command prompt, cd to the directory
containing the build.xml file
(<jbossts_install_root>/trail_map) and
type 'ant', unless already done in the
installation section
. This will compile a set of sources files
located under
<jbossts_install_root>/trail_map/src then
create an application .jar file named
jbossts-demo.jar
. under the directory
<jbossts_install_root>/trail_map/lib
-
Add the generated jar file to the CLASSPATH
environment variable.
-
The demo application is provided in several
ways, accessing persistent data or not. When
JDBC is used as a mean to access a database,
Oracle 9i is used. For this aim the appropriate
Oracle libraries (classes12.zip) should be add
in the CLASSPATH environment variable.
Local transaction with JTA
To configure JBossTS for such transaction, edit the
jbossts-properties.xml file and set the following
properties to the appropriate values:
<property
name="com.arjuna.ats.jta.jtaTMImplementation"
value="com.arjuna.ats.internal.jta.transaction.
arjunacore.TransactionManagerImple"/>
<property
name="com.arjuna.ats.jta.jtaUTImplementation"
value="com.arjuna.ats.internal.jta.transaction.
arjunacore.UserTransactionImple"/>
Distributed transaction with JTA
While for a distributed transactions case, JBossTS need
to be configured as follow:
<property
name="com.arjuna.ats.jta.jtaTMImplementation"
value="com.arjuna.ats.internal.jta.transaction.
jts.TransactionManagerImple"/> <property
name="com.arjuna.ats.jta.jtaUTImplementation"
value="com.arjuna.ats.internal.jta.transaction.
jts.UserTransactionImple"/>
Using JTA to create a distributed transaction need
the creation of an ORB instance as done by a JTS
application (see JTS versions of the banking
application), the difference is in the interface
used to demarcate and control transactions.
The application programming interfaces used by the
Banking Application
To illustrate the programming interfaces
possibilities enabled by JBossTS, the banking
application is provided in several versions: a
version that uses the JTA API and a second that uses
JTS/OTS interfaces.
This trail focuses to understanding concepts related
to the creation of transactions and the behavior of
the commitment protocol, while the next trail
illustrates the similar application with persistent
data.