Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

How to use BTM as the transaction manager in Jetty 6.x

These instructions have been verified against BTM 1.1.

Info
titleJetty 6 JNDI support

Before you can get the transaction manager and datasources via JNDI ENC (URLs starting with java:comp/), you first need to configure Jetty with support for it.
See Jetty's JNDI documentation page.

Contents

Table of Contents
maxLevel3
minLevel2

Step 1: Copy the BTM jars

Copy the following jars from the BTM distribution to the jetty6 lib/ directory:

  • btm-1.1.jar
  • geronimo-spec-jta-1.0.1B-rc4.jar
  • slf4j-jdk14.jar (or any other one available here)

Step 2: Configure BTM as the transaction manager

Copy the following into your jetty config file:

...

Tip
titleHint

This will make the transaction manager available under this JNDI URL: java:comp/UserTransaction.

Step 3: Configure DataSources that are transaction aware

The easiest way to do this is to use the DataSource that ship with BTM.

...

Again, we've used Derby as an example, but as the LrcXADataSource uses only the class name and url of a java.sql.Driver, you can use it with any database providing a JDBC driver.

Step 4: Configure datasources references in your web.xml

Before your code can access configured datasources via JNDI ENC URLs, you need to declare resource references in your web.xml:

...