tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: InitialContext
Date Fri, 09 Nov 2001 17:07:22 GMT

On Fri, 9 Nov 2001, The Duke wrote:

> Date: Fri, 09 Nov 2001 15:04:56 +0100
> From: The Duke <>
> Reply-To: Tomcat Users List <>,
> To:
> Subject: InitialContext
> I would like to know what the InitialContext is. I searched in the
> user docs, but could not find anything.

I assume you mean what you get when you call:

  InitialContext context = new InitialContext();

right?  That is a per-web-application place where the container can
provide services and resources (like database connection pools) to a web
application, which can access them in a portable manner.  The
InitialContext API itself is from the Java Naming and Directory Interface

All J2EE servers are required to provide a naming context to each web
application, preconfigured with resources that were filled in by the
system administrator of your server.  Tomcat 4 supports a JNDI context
compatible with J2EE (except for not supporting EJBs), so that programs
you write here are portable to J2EE servers later.

For more info, you might want to browse the source code of the
"JndiExamples" class in the "/examples" webapp (it's under
/WEB-INF/classes), or consult the documentation on setting up your own
JNDI resources:

where, you will see, you configure the resources to be provided in the
server.xml file.

To know what kinds of resources J2EE servers are required to provide to
web apps, you might also want to read the "J2EE Platform Specification"
(version 1.3), which is available via:

> thnx
> Dennis Knol

Craig McClanahan

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message