tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Datasource and Web.xml
Date Tue, 03 Dec 2002 04:23:23 GMT

On Tue, 3 Dec 2002, Peng Tuck Kwok wrote:

> Date: Tue, 03 Dec 2002 12:09:42 +0800
> From: Peng Tuck Kwok <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: Datasource and Web.xml
> If a web application uses a jndi datasource, should the web.xml contain
> the definition for the datasource before deployment (that is in the war
> file) or after deployment (that is after the war file has been deployed)
> ? This sounds strange as I was having problems with this in tomcat
> 4.1.12 , where Tomcat could not start if the there was a resource
> definition in the web.xml. Of course I can't create a resource for the
> context using the admin interface since the context doesn't exist yet.
> I've used Sun one server and all seems ok so what is the correct
> sequence for doing things in tomcat?

There is not really a pre-deploy versus post-deploy state of the web.xml
file in Tomcat stand-alone.  The net effect of this is that:

* You MUST declare your JNDI resources in the web.xml file before
  you deploy the app (i.e. in the original web.xml file you provide)

* You MUST configure your JNDI resources in either server.xml
  at Tomcat startup time (nested in the <Context> element) or
  dynamically if you deploy via the manager webapp, in which case
  you must provide a context configuration file that includes the
  resource configurations.

If you're using the admin webapp to create resources, what you're actually
doing is setting up things in the <GlobalNamingResources> section of
server.xml -- the resources are not actually configured to a particular
webapp until you include a <ResourceLink> element in the <Context> element
for that webapp.

For more info about JNDI resources in general:

For detailed walkthroughs (using the Java Web Services Developer Pack, but
the instructions for JNDI resources are also generally applicable to
Tomcat 4.1 standalone use), see the webapp related chapters in the Java
Web Services Tutorial:


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message