Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


Code Block

Configuring env-entrys shows you how to set up overrides for <env-entry> elements in web.xml. Configuring resource-refs and resource-env-refs discusses how to configure support resources such as javax.sql.DataSource.

Furthermore, it is possible to plug a JTA javax.transaction.UserTransaction implementation into Jetty so that webapps can lookup java:comp/UserTransaction to obtain a distributed transaction manager. See Configuring XA Transactions.

You can define your naming resources with 3 scopes:

  1. jvm scope - the name is unique within the jvm
  2. server scope - the name is unique to the Server instance
  3. webapp scope - the name is unique to the WebAppContext instance

The section Global or scoped to a webapp explains what scoping is, and shows you how to use it. Essentially, scoping ensures that JNDI bindings from one webapp do not interfere with the JNDI bindings of another - unless of course you wish them to.


  • "" for <env-entry>s
  • "" for all other type of resources
  • "" for a JTA manager. We'll take a closer look at this in the Configuring XA Transactions section.
  • "" for link between a web.xml resource name and a NamingEntry. See Configuring Links for more info.

There are 3 places in which you can define naming entries:


This example will define a virtual <env-entry> called mySpecialValue with value 4000 that is unique within the whole jvm. It will be put into JNDI at java:comp/env/mySpecialValue for every webapp deployed. Moreover, the boolean argument indicates that this value should override an env-entry of the same name in web.xml. If you don't want to override, then omit this argument or set it to false.

See Global or scoped to a webapp for more information on other scopes.


Contact the core Jetty developers at
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 from 1 day to full product delivery