Jetty Logo
Version: 9.3.14.v20161028
Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

Chapter 12. Configuring JNDI

Table of Contents

Quick Setup
Working with Jetty JNDI
Configuring JNDI
Using JNDI with Jetty Embedded
Datasource Examples

Jetty supports java:comp/env lookups in webapps. This is an optional feature for which some configuration is required.

Quick Setup

If you are using the standard distribution of Jetty, you must enable the JNDI module to obtain Jetty’s JNDI implementation, and the plus module which provides classes for interacting with JNDI. As the plus module depends on the JNDI module, you only need to enable the plus module to enable both. Assuming you have Jetty installed in /opt/jetty, and you have made a jetty base in /opt/jetty/my-base, do:

cd /opt/jetty
cd my-base
java -jar $JETTY_HOME/start.jar --add-to-startd=plus

You can now start Jetty and use JNDI within your webapps. See Using JNDI for information on how to add entries to the JNDI environment that Jetty can look up within webapps.

If you have extra jars associated with your JNDI resources, for example a database driver jar, and you haven’t made a custom module for it, you can put the jars into your {$jetty base}ext/ directory. You will then need to enable the ext module to ensure the jars in the ext/ directory are on the classpath. Assuming you have Jetty installed in /opt/jetty, and you have made a jetty base in /opt/jetty/my-base, do:

cd /opt/jetty
cd my-base
java -jar $JETTY_HOME/start.jar --add-to-startd=ext

See an error or something missing? Contribute to this documentation at Github!(Generated: 2016-10-28)