Versions Compared


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

What is jetty-env.xml?

A jetty-env.xml file is an optional file that you can place in your webapp's WEB-INF directory to configure JNDI resources specifically for that webapp.

The syntax of the file is the same as for the jetty-web.xml file.

At startup, jetty will automatically look for a file of this name in the webapp's WEB-INF directory, and set up the webapp's naming environment so that naming references in the WEB-INF/web.xml file can be resolved from the information in the WEB-INF/jetty-env.xml file (along with any global naming resources defined in a jetty.xml startup file.

Here is an example:

Code Block

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "">

<Configure class="org.mortbay.jetty.webapp.WebAppContext">

  <!-- Add an EnvEntry only valid for this webapp               -->
  <New id="gargle"  class="">
    <Arg type="java.lang.Double">100</Arg>
    <Arg type="boolean">true</Arg>

 <!-- Add an override for a global EnvEntry                           -->
  <New id="wiggle"  class="">
    <Arg type="java.lang.Double">55.0</Arg>
    <Arg type="boolean">true</Arg>

  <!-- an XADataSource                                                -->
  <New id="mydatasource99" class="">
     <New class="com.atomikos.jdbc.SimpleDataSourceBean"><Set name="xaDataSourceClassName">org.apache.derby.jdbc.EmbeddedXADataSource</Set><Set name="xaDataSourceProperties">databaseName=testdb99;createDatabase=create</Set><Set name="UniqueResourceName">mydatasource99</Set></New>


There is more information and examples in the section on JNDI.

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