tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: JNDI Initial Context, outside webapp
Date Wed, 09 Oct 2002 18:29:10 GMT
Please don't cross-post to both TOMCAT-DEV and TOMCAT-USER (especially on
a question like this, which is more user oriented).

On Wed, 9 Oct 2002, Luca Zago wrote:

> Date: Wed, 09 Oct 2002 20:19:18 +0200
> From: Luca Zago <>
> Reply-To: Tomcat Users List <>
> To:
> Subject: JNDI Initial Context, outside webapp
> Hi,
> I noticed that is pratically impossible to retrieve a JNDI resource
> outside a webapp.If I need to access my resourse in some classes
> istantiated outside a single webapp, I always get an exception.
> Name jdbc/myDS is not bound in this Context

This is by design -- webapps are supposed to be designed to be

> I read the docs. If I understand well, the initialContext is read-only,
> (for this reason I cannot published a resource there), then the only
> context available is "java:comp/env", available only insdie a webapp.
> I think that a solution could be: since initialContext for sure is
> initialized before webapps, if I can publish a resource there, then I
> can access this resource outside a webapp. have I understood well, is it
> so impossible to publish in the initialContext, like in other
> Application servers?
> is there a way to access a JNDI resource outside a webapp?
> or is it a limitation of the JNDI implementation in Tomcat?
> Thank you in advance for suggestions or explanation.

If you're using Tomcat 4.1, one strategy would be to define your shared
data source in the <GlobalJNDIResources> section of server.xml, and create
a <ResourceLink> for each webapp that needs access to that data source.

> --
> Luca Zago
> Senior IT Developer


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

View raw message