tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: accessing env-entries from servlet
Date Wed, 08 Nov 2000 18:01:52 GMT
Thom Park wrote:

> Hi,
> I've set up a webapp to define an env-entry and all looks well,
> Tomcat has identified the correct env-entry type/name/value and
> stuck
> the data in the Hashtables in the Context.
> Can someone suggest how to access this data? I've tried the
> 'standard'
> way (defining a javax.naming.InitialContext) and tried to look
> it up as a java:comp/env naming construct but I'm finding that
> as I haven't set up service provider this approach fails with a
> NoInitialContextException.
> I understand why this is the case but I'm wondering how one is
> meant to get at these env-entry things in the first place. Does
> Tomcat have a service provider that can let me have access to
> the env-entry hashtable objects squirreled away in the Context
> object (note Tomcat context not naming context)?

Tomcat 3.x, as well as versions up to and including Tomcat 4.0 milestone
4, do not have support for a naming context by themselves (although when
Tomcat is embedded in a J2EE server, this support is provided by the
server).  As such, you cannot access <env-entry>, <resource-ref>, or
<ejb-ref> type information.  The alternative is to use context
initialization parameters (<context-parm>) for global config

Support for naming contexts is being actively developed for Tomcat 4.0,
and should be available in milestone 5.

> If not, how are these things meant to be used, if not in the
> standard way.
> Right now, it looks to me that I'm going to have to build my own
> support for these things and expose the object/name lookup via
> my own service provider = that seems an awful lot of work to
> access something that seems to be already there ;-)
> Can anyone advise me that might have used the env-entry
> constructs before with Tomcat 3.2?

If you're using 3.2, you will either need to roll your own support, or
use context parameters instead.

> thanks,
> Thom

Craig McClanahan

View raw message