On Fri, 22 Nov 2002, Jonathan Williamson wrote:
> Date: Fri, 22 Nov 2002 18:03:21 +0000 (GMT)
> From: Jonathan Williamson <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: JNDI name space conventions
>
> I'm trying to write some code that uses JNDI to look
> up a JDBC DataSource to get a Connection.
>
> My code works fine in Tomcat 4.1 if I use the
> java:comp/env naming context, as in the following
> code:
>
> Context initContext = new InitialContext();
> DataSource ds =
> (DataSource)initContext.lookup("java:comp/env/jdbc/myoracledb");
>
> If I try to run this in JRun 4 or Oracle 9iAS, I get a
> NamingException. Instead I have to do it like this
> (doesn't work in Tomcat):
>
> Context initContext = new InitialContext();
> DataSource ds =
> (DataSource)initContext.lookup("jdbc/myoracledb");
>
> I found this article on Macromedia's web site that
> sort of describes the problem I'm having:
> http://www.macromedia.com/v1/Handlers/index.cfm?ID=22927&Method=Full
>
> They say there that according to the Servlet 2.3
> specification, JNDI lookups should be relative to
> java:comp/env anyway. I have a printed copy of the
> Servlet 2.3 specification, and from what I've seen by
> skimming through it, jndi naming contexts aren't
> mentioned at all (I could be wrong there though).
>
> Is this configured by some sort of setting in Tomcat?
> I can't seem to find one, or anything in the manuals
> for that matter.
>
The reason you're not finding this in the servlet spec is because it's in
the J2EE Platform Spec, in the chapter on Naming. Tomcat implements its
JNDI naming context in a manner that is consistent with this.
Go about halfway down the following page for links to the specs, and grab
the one for J2EE 1.3 (corresponds to Servlet 2.3 and JSP 1.2, which is
what Tomcat 4.x implements):
http://java.sun.com/j2ee/download.html
> Thanks,
> Jonathan
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>