> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: Can a JNDI resource be in a webapp's lib folder > > Hmm... I didn't realize that. I didn't know that the servlet spec > mandated JNDI behavior "above" the webapp level.
I don't think it's the servlet spec itself that does that; rather, it's the interaction of that with the JNDI spec. You start off with a new InitialContext(), and go from there - so by default, everything is global. There doesn't appear to be anything preventing use of local contexts (created via the InitialContext(Hashtable environment) constructor), but the servlet spec doesn't mention it. The servlet spec does contain this somewhat contradictory statement: "The name is a JNDI name relative to the java:comp/env context and must be unique within a web application." Unfortunately, java:comp/env is global, so the JNDI name must also be unique /across/ web applications. I suppose it would be possible to create a separate java:comp/env context for each webapp, but Tomcat doesn't do that (I don't know if anyone does). > Is this made more explicit anywhere else? Not that I've found. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.