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 <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 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
self-contained.

> 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.

 http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

>
> --
> Luca Zago
> Senior IT Developer

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to