Howdy,

>I don't follow you -- shouldn't I be able to create an instance of a
naming
>context and populate it from within my App, then refer back to it?  For

No.  You need a JNDI provider to do this.  There is a lot going on in
the background when you create naming context and bind into them.

>        javax.sql.DataSource ds = null;
>
>        try {
>            // Obtain our environment naming context
>            javax.naming.Context initCtx = new
>javax.naming.InitialContext();

This uses the default initial context factory, which is not tomcat.  To
use tomcat's initial context factory, you need to configure the initial
context above, e.g.
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.naming.java.javaURLContextFactory");
ht.put(Context.PROVIDER_URL, http://mytomcatserver);
Context initCtx = new InitialContext(ht);

If you're not clear on the difference between your code (the default
initial context constructor) and the above, read up on JNDI.

The tomcat initial context factory implementation (the class named
above) is here:
http://cvs.apache.org/viewcvs/jakarta-tomcat-catalina/catalina/src/share
/org/apache/naming/java/

Now, if you tried the above, and had a tomcat server running, and had
the naming jar in your classpath (so your app does need to know about
tomcat, however implicitly, via classpath and class name above), it
STILL wouldn't work.  That's because tomcat doesn't support external
JNDI calls.

>What else can I use as a JNDI provider?

Any full-featured J2EE server (e.g. JBoss), and some specific
non-full-J2EE servers that support external JNDI, e.g. OpenJMS.

Or you could enhance tomcat to support external JNDI ;)

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to