Version: 9.4.27.v20200227 |

Chapter 12. Configuring JNDI
Previous | Part III. Jetty Administration Guide Home | Next

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

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-start=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-start=ext

Previous | Top | Next
Jetty Dump Tool | Home | Working with Jetty JNDI

See an error or something missing? Contribute to this documentation at Github!(Generated: 2020-02-27)