You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "McClure, James" <jm...@atxg.com> on 2004/07/19 23:19:56 UTC

DefaultContext content not available in Servlet init()

Hello users,

My environment: Tomcat 4.1.24, JDK 1.4.1_02, XP.

I'm attempting to move some existing jdbc initialization into my servlet's
init() method which uses JNDI lookup.  This is failing and yielding an
exception with the message: "Name jdbc is not bound in this Context".  The
exception is being thrown during the call to the context lookup() method.
Prior to these modifications, the same logic exists in the doGet() portion
of the servlet and works just fine.  My current server.xml configuration
contains a DefaultContext section which contains all of my various jdbc
resources since these are common to all of web-apps.

By trial and error, I have found that if I make a copy of the DefaultContext
content and place it as a part of *each* web-app context, then the relocated
logic works in init().  However, maintaining multiple entries for each jdbc
source I have is not acceptable.

I've seen complaints about DefaultContext not working properly, but cannot
find anyone who has a workaround for this specific issue.

Has anyone seen and addressed this issue successfully?

James McClure
jmcclure@atxg.com