web.xml configuration

The following elements may be used in the web application deployment descriptor (/WEB-INF/web.xml) of your web application to define resources:

  • <env-entry> – Environment entry, a single-value parameter that can be used to configure how the application will operate.
  • <resource-ref> – Resource reference, which is typically to an object factory for resources such as a JDBCDataSource, a JavaMail Session, or custom object factories configured into Tomcat.
  • <resource-env-ref> – Resource environment reference, a new variation of resource-ref added in Servlet 2.4 that is simpler to configure for resources that do not require authentication information.

Providing that Tomcat is able to identify an appropriate resource factory to use to create the resource and that no further configuration information is required, Tomcat will use the information in /WEB-INF/web.xml to create the resource.

Tomcat provides a number of Tomcat specific options for JNDI resources that cannot be specified in web.xml. These include closeMethod that enables faster cleaning-up of JNDI resources when a web application stops andsingleton that controls whether or not a new instance of the resource is created for every JNDI lookup. To use these configuration options the resource must be specified in a web application’s <Context> element or in the<GlobalNamingResources> element of $CATALINA_BASE/conf/server.xml.

Share this post
[social_warfare]
Introduction to JNDI Resources
context.xml configuration

Get industry recognized certification – Contact us

keyboard_arrow_up