tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "D'Alessandro, Arthur" <Arthur.D'>
Subject Re: Newbie - JDBC problem "Name is not bound in this context"
Date Sat, 07 Aug 2004 23:14:58 GMT
Add a resourcelink to your context definition.

 -----Original Message-----
From: 	ohaya []
Sent:	Sat Aug 07 18:07:42 2004
To:	Tomcat Users List
Subject:	Re: Newbie - JDBC problem "Name is not bound in this context"

> I'm not a JNDI expert but you can try this:
> Context ic = new InitialContext();
> Context ctx = (Context) ic.lookup("java:comp/env");
> DataSource ds = (DataSource) ic.lookup("jdbc/jimnew");

Hi Dennis,

I've been wrestling with this problem for most of today, and at this
point, I don't think the problem is with the code, but rather, I think
it's some kind of problem with configuration.  What it looks like is
that Tomcat, for some reason, doesn't think that there is a resource
called 'jdbc/jimnew', even though 'jdbc/jimnew' appears to exist in
GlobalNamingResources in server.xml.

After working on this for hours, I'm a bit confused about this, as my
impression was that if a resource was defined in GlobalNamingResources,
then any application would be able to access that resource.

I kind of "cheated" a bit with my small test page, and maybe that's why
things aren't working.

When Tomcat installed, it had a bunch of demo applications at
http://myhost/jsp-examples.  Just for this (I thought) quick test, I
created a single JSP file, test.jsp in the jsp-examples directory,
because I didn't want to go through all of the things to set up a new
"application" in Tomcat, and I thought that my test.jsp would be
automatically able to "see" the resources in GlobalNamingResources.

Well, I'm either doing something wrong, or my assumption was wrong,
because I keep getting that error ("jdbc not bound in this context"),
and I can't find any way around it.  I've tried adding the resource-ref,
res-ref-name, res-type, and res-auth to the web.xml in the
jsp-examples\WEB-INF directory, but even that didn't do the trick.

At this point, I'm kind of stuck, and I'm hoping that someone on this
list can tell me how I might be able to make this resource visible to my

If I can't figure that out, I'm probably going to just try doing the
JDBC stuff directly, without JNDI, etc...

Thanks for trying...


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message