tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Audley <Christopher.D.Aud...@jhu.edu>
Subject AdaptiveClassLoader not finding jndi.properties [PATCH]
Date Mon, 12 Mar 2001 00:26:47 GMT
The following discussion applies to tomcat 3.2.1 running under Sun JDK 1.3

I spent this afternoon tracking down why a call to new InitialContext() 
from a web application did not appear to be finding the jndi.properties 
located under WEB-INF/classes.  I am using the Jdk12Interceptor and 
verified that Thread.currentThread().getClassLoader() was the tomcat 
AdaptiveClassLoader before the call to new InitialContext().  After some 
investigation I determined that the JNDI implementation uses the 
classloader method getResources to find all occurances of the file 
jndi.properties in the classpath.  AdaptiveClassLoader does not have 
this method implemented, the default implementation calls findResources 
which simply returns an empty Enumeration unless overriden.

Attached are patches to AdaptiveClassLoader and ClassRepository to 
implement findResources so that JNDI will behave correctly when a 
jndi.properties is placed in the web application classpath.  I have 
moved some code from AdaptiveClassLoader to ClassRepository to avoid 
code duplication and changed the implementation of getResource to 
findResource for consistency.

I hope that this can be incorporated into the sources before 3.2.2.

Cheers
Chris

Mime
View raw message