Demo Home
Test Web Application Only - Do NOT Deploy in Production

JNDI Test WebApp

This example shows how to configure and lookup resources such as DataSources, a JTA transaction manager and a java.mail.Session in JNDI.


To enable JNDI in a base jetty instance do:

    $ cd $JETTY_BASE
    $ java -jar $JETTY_HOME/start.jar --add-to-startd=jndi

This will create a $JETTY_BASE/start.d/jndi.ini file to enable and parameterise JNDI. If the --add-to-start option instead, then the same initialisation will be appended to the $JETTY_BASE/start.ini file instead. The jetty demo-base already has JNDI enabled in the start.ini file and some mock resources included.

The full source of this demonstration is available here.


Click Test to check the runtime lookup of the JNDI resources.