# Jetty 6 and JNDI

This example shows how to configure and lookup resources such as DataSources, a JTA transaction manager and a java.mail.Session in JNDI. The demo shows you how to perform a distributed transaction across two different databases, and how to send email.

## Preparation

1. Ensure that you have installed the jars for the transaction manager of your choice in $JETTY_HOME/lib/ext. This demo has been tested with JOTM and Atomikos.
2. Make sure you have built this demo. Assuming your jetty src distro is installed at $JETTY_HOME:

   >       +  cd $JETTY_HOME/modules/test-jndi-webapp
   >       +  mvn clean install

3. Set up the configuration files with the transaction manager of your choice:

   >       +  cd $JETTY_HOME
   >       +  edit etc/jetty-test-jndi.xml and uncomment one of the transaction manager setups
   >       +  edit webapps-plus/test-jndi/WEB-INF/jetty-env.xml and uncomment one of the transaction manager setups

Now you can start the demo:

>       > java -jar start.jar etc/jetty.xml etc/jetty-plus.xml etc/jetty-test-jndi.xml

If you want to use the Mail demonstration, you will need to edit the `etc/jetty-test-jndi.xml` file and change the smtp authentication information and properties appropriately for your environment.

## The Datasources/Transaction Demo

Click `Commit` to make a distributed update to 2 different databases, or `Rollback` to prevent the update from happening.

Commit
Rollback

## The Mail Demo

Send a test email to:

From: