On Tue, 3 Dec 2002, Peng Tuck Kwok wrote:
> Date: Tue, 03 Dec 2002 12:09:42 +0800 > From: Peng Tuck Kwok <[EMAIL PROTECTED]> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > To: Tomcat Users List <[EMAIL PROTECTED]> > 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: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html 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: http://java.sun.com/webservices/docs/1.0/tutorial/index.html Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>