Home

# Jetty 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

This demonstration will use the Atomikos transaction manager and the Derby database by default. If you wish to use JOTM instead, edit the context/test-jndi.xml file and the webapps/test-jndi/WEB-INF/jetty-env.xml file and uncomment the JOTM setup. If you prefer to use a different database then edit these same files and replace the DataSource definitions to correspond to the database of your choice.

If you want to use the Mail demonstration, you will need to edit the `$JETTY-HOME/contexts/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: