On Wed, 5 Feb 2003, Joe Tomcat wrote:
> Date: 05 Feb 2003 05:52:16 -0800
> From: Joe Tomcat <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: JNDI success, and questions
>
> I just set up Tomcat to work as a JNDI source for DB connections.
> Following the how-to instructions, it worked very easily. This seems to
> be a very sane way to manage a db connection pool. However, before I go
> crazy and change all of my web app code to use JNDI instead of the way
> they are currently working, I am wondering, are there any drawbacks to
> this? Is this the best way to go? If later on I want to use some of
> these packages not in Tomcat, how hard is it to set up a JNDI context
> outside of Tomcat?
>
The "outside of Tomcat" thing can be an issue.
J2EE servers are required to support an "application client" mode that
includes things like the JNDI support for standalone applications, similar
to what Tomcat provides for webapps. If you're not in that world, you
would have to:
* Provide an implementation of the JNDI APIs for an
in-memory implementation of the naming contexts
(which is what Tomcat actually has, in the org.apache.naming
package).
* Provide a way to configure and populate the resources
in that context at application startup time (which is
what Tomcat does when reading server.xml).
* Provide a JNDI "InitialContext" implementation and
configuration so that app calls to:
InitialContext ic = new InitialContext();
do the right thing (this is all documented in the JNDI
specs at <http://java.sun.com/products/jndi>).
If I had loads of spare time, it would be interesting to factor the JNDI
implementation code out of Tomcat and into a commons package, and support
a simple configuration file format for populating it. Spare time, alas,
is not really on my schedule at the moment ... but I would certainly cheer
from the sidelines (and answer questions) if anyone else wanted to try
this.
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]